Forge I18n for Jira Global Page App (Custom UI) not working

"@forge/bridge": "5.0.0",


import { i18n, view } from '@forge/bridge';

    view.getContext()
      .then(c => {
        i18n.getTranslations().then((translationsBundle: any) => {
          console.log('translationsBundle', translationsBundle);
        }).catch((e) => {
          console.log('Error getting translations: ', e);
        });
      });

Results in error (screenshot). Although I was following the sample shown for Confluence macro https://developer.atlassian.com/platform/forge/internationalization/. It is working there.

1 Like

Hey @OlehKosar, this error is from not being able to read/get the i18n-info.json file.
Could you check the following:

Setup of translations in the manifest should be structured like this:

translations:
  resources:
    - key: en-US
      path: locales/en-US.json
    - key: en-GB
      path: locales/en-GB.json

Structure of translation files follow - https://developer.atlassian.com/platform/forge/manifest-reference/translations/#example

Lastly, when you deploy, if you run FORGE_INSPECT_ARCHIVE=archive forge deploy can you check if there is a i18n-info.json file and the validity of the contents?

If you want to send more app-specific context, feel free to open a support ticket.

Cheers,

Yuwei

1 Like

Hi @YuweiShen!

Thanks for answering.

Yes, the structure is like this:

translations:
  resources:
    - key: en-US
      path: locales/en.json
  fallback:
    default: en-US

It is working for manifest.yaml when using like this:

modules:
  jira:globalPage:
    - key: app-menu-page-dialog
      resource: main
      title:
        i18n: app.title

But then it’s erroring when using in code via Forge Bridge (like described above).

_________

Still same Http Code 422 for i18n-info.json when just used FORGE_INSPECT_ARCHIVE=archive forge deploy.

Best regards,

Oleh

1 Like

@YuweiShen checked the local archive generated on my PC

i18-info.json is valid and is

{"translations":{},"config":{"locales":["en-US"],"fallback":{"default":"en-US"}}}

en-US.json file is in the folder too with keys and values.

1 Like

My colleague reported with attached archive in this ticket: Jira

1 Like