Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Internationalization not working #1276

Closed
wants to merge 2 commits into from

Conversation

schleuss
Copy link

@schleuss schleuss commented Feb 24, 2022

Signed-off-by: Rafael Schleuss rschleuss@gmail.com

Description

Fixed issue with internationalization. The pattern used in the globby lib was wrong and the .i18nrc.json resource files were not found.

Issues Resolved

[BUG] Internationalization not working

Check List

  • New functionality includes testing.
    • All tests pass
      • yarn test:jest
      • yarn test:jest_integration
      • yarn test:ftr
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff

@schleuss schleuss changed the title 1.2 [BUG] Internationalization not working Feb 24, 2022
@kavilla
Copy link
Member

kavilla commented Feb 24, 2022

Hello @schleuss, thanks for opening this PR! Appreciate the help. A few things:

Can you tell me how to verify what was broken here and what it fixes? We don't have any i18n translations files in the project currently (although we are working on it). So is there something that this catches?

I'm not positive if there is a full release planned for 1.2.1 we can have one, but I'd suggest the fix be addressed in main then backported to 1.x and if we need to have a 1.2.1. Then we should create a version bump commit in 1.2 and then backport the original PR to 1.2.

Thanks for the clarification!

@schleuss
Copy link
Author

Hello @kavilla,

I'm working on the translation to pt-BR.

My process was:

  • Clone the translation repository
  • Run the integration script (node scripts/i18n_integrate)
  • Run build
  • Start the app

The translation is not displayed. Doing some tests I noticed that the .i18nrc.json file is not found where executing the i18nMixin function:

src/legacy/server/i18n/index.ts

  const translationPaths = await Promise.all([
    getTranslationPaths({
      cwd: fromRoot('.'),
      glob: `*/${I18N_RC}`,
    }),
    ...(config.get('plugins.paths') as string[]).map((cwd) =>
      getTranslationPaths({ cwd, glob: I18N_RC })
    ),
    ...(config.get('plugins.scanDirs') as string[]).map((cwd) =>
      getTranslationPaths({ cwd, glob: `*/${I18N_RC}` })
    ),
    getTranslationPaths({
      cwd: fromRoot('../opensearch-dashboards-extra'),
      glob: `*/${I18N_RC}`,
    }),
  ]);

I did some tests with this globby lib, and found that it would be necessary to change the pattern to **/.i18nrc.json and not the current */.i18nrc.json

With this tweak, the configuration file was found and the translation loaded correctly.

--

About the version, I can redo the PR on the main branch, no problem. I ended up doing it in release 1.2 because it's the one I currently use.

schleuss pushed a commit to schleuss/OpenSearch-Dashboards that referenced this pull request Feb 28, 2022
@kavilla
Copy link
Member

kavilla commented Mar 2, 2022

About the version, I can redo the PR on the main branch, no problem. I ended up doing it in release 1.2 because it's the one I currently use.

@schleuss, will you be able to sign your commit as well? [how to]

@schleuss schleuss closed this Mar 17, 2022
@schleuss
Copy link
Author

Sorry @kavilla,
there are other points that need to be checked in order get system correct translated.

I've checked other issues that still need to be resolved, as well as external components that cannot be translated today (@elastic/eui)

As soon as possible I will try to create a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants