Expand my Community achievements bar.

SOLVED

Access i18n json files under /apps

Avatar

Level 1

I am trying to follow this guide

How to Get AEM i18n Dictionary in JSON Format | Sourced Code

to expose the i18n json of specific dictionaries separately to the public

 

e.g. I have this two dictionary in the translator

apps/project/i18n/componentA
apps/project/i18n/componentB

 

I want to get the json for componentA in one file and componentB in another file

 

It is working only when I am authenticated in the AEM instance

 

As /apps/ is not accessible without authentication

Any way to expose the i18n json file of each dictionary to the public?

 

Currently is using /libs/cq/i18n/dict.en_us.json, but it combines every dictionaries and the file is keep growing

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @charlieshum 

I hope it may help you in exposing i18n configs to access publicly.

We have similar kind of requirement but exposing them to consume in FE as json.

Using webpack module we copy the i18n json files from /apps/myproject/i18n folder into clientlib resource folder. and we access i18n which is under /app through proxy etc.clientlib

        new CopyWebpackPlugin([
            { from: path.resolve(__dirname, SOURCE_ROOT + '/resources'), to: './clientlib-site/' },
            {
                context: '../ui.apps/src/main/content/jcr_root/apps/myproject/i18n/',
                from: '**/*.json',
                to: './clientlib-site/i18n'
            }
        ])

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

Hi @charlieshum 

I hope it may help you in exposing i18n configs to access publicly.

We have similar kind of requirement but exposing them to consume in FE as json.

Using webpack module we copy the i18n json files from /apps/myproject/i18n folder into clientlib resource folder. and we access i18n which is under /app through proxy etc.clientlib

        new CopyWebpackPlugin([
            { from: path.resolve(__dirname, SOURCE_ROOT + '/resources'), to: './clientlib-site/' },
            {
                context: '../ui.apps/src/main/content/jcr_root/apps/myproject/i18n/',
                from: '**/*.json',
                to: './clientlib-site/i18n'
            }
        ])