OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

Update locales.js for support pl language

Open fcientymeh opened this issue 1 year ago • 11 comments

Description

Opensearch-dashboard uses two kinds of translating engines:

<FormattedMessage> and i18n.translate.

i18n.translate works from scratch, but <FormattedMessage> needs to have localization country shortcut in locales.js file. If not - opensearch-dashboards must be build from source with newly added new localization country. This is very problematic. I didn't found other solution.

Ultimately, adding support for a new language should not force compilation of the product

Testing the changes

Check List

  • [x] All tests pass
    • [x] yarn test:jest
    • [ ] yarn test:jest_integration
  • [ ] New functionality includes testing.
  • [ ] New functionality has been documented.
  • [ ] Update CHANGELOG.md
  • [ ] Commits are signed per the DCO using --signoff

fcientymeh avatar Apr 01 '24 19:04 fcientymeh

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 54.20%. Comparing base (45d34b5) to head (98001e6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6301   +/-   ##
=======================================
  Coverage   54.20%   54.20%           
=======================================
  Files        3251     3251           
  Lines       70655    70657    +2     
  Branches    10828    10828           
=======================================
+ Hits        38300    38302    +2     
  Misses      30334    30334           
  Partials     2021     2021           
Flag Coverage Δ
Linux_1 30.76% <100.00%> (+<0.01%) :arrow_up:
Linux_2 55.60% <100.00%> (+<0.01%) :arrow_up:
Windows_1 30.77% <100.00%> (+<0.01%) :arrow_up:
Windows_2 55.56% <100.00%> (+<0.01%) :arrow_up:
Windows_4 31.49% <100.00%> (+<0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 01 '24 23:04 codecov[bot]

Hi @fcientymeh Can you add details to the PR description's sections so that its clear what this change is addressing?

ashwin-pc avatar Apr 02 '24 00:04 ashwin-pc

@ashwin-pc - thank you for your feedback. Generally speaking - we needs (I hope many others too) to have localized opensearch-dashboards. The problem is that adding translation support for <FormattedMessage> requires recompiling the product,, if theres is no locale defined in locales.js file for some new country.

I think this could be separated as a new issue.

fcientymeh avatar Apr 02 '24 01:04 fcientymeh

Thanks for doing this. Yes this is a known issue. It requires the update this for functional purposes along with the translation.

Looks good to me as much as I can verify.

kavilla avatar Apr 05 '24 21:04 kavilla

@fcientymeh looks like you want to add a new locale for the app. have you taken a look at the i18n plugin? https://github.com/opensearch-project/dashboards-i18n/blob/main/DEVELOPER_GUIDE.md

also here is a guide about i18n https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/packages/osd-i18n/README.md.

ashwin-pc avatar Apr 08 '24 08:04 ashwin-pc

@kavilla im a little confused, do we have an open issue for this?

ashwin-pc avatar Apr 08 '24 08:04 ashwin-pc

Hello. Yes, we use a plugin i18n for translating OpenSearch-Dashboards. As I said - it works great, but when we using i18n.translate func, not for <FormattedMessage>. I will look for solution for this. One of my the idea is (at this time) to use default en translation, if there is not proper language defined in locales.js, but I don't know , if it is possible.

ps. I've started some work on translation Opensearch Dashboards (still have problem with DCO, but it was my fault, so PR hangs): https://github.com/opensearch-project/dashboards-notifications/pull/180

fcientymeh avatar Apr 11 '24 07:04 fcientymeh

Ah nice. Sorry we took so long. I think that this can go in for now to unblock you. @ananzh can you look into this later to see why we need to hardcode these?

ashwin-pc avatar Apr 26 '24 08:04 ashwin-pc

@fcientymeh I think we can squash all the commits on merged and make

Signed-off-by: Andrzej M. <[email protected]>

The signed off if correct.

kavilla avatar Apr 27 '24 00:04 kavilla

I had problem with DCO because of using space and dot(.) in username. See below pls: image

I fixed this already by changing username simply to AndrzejM

fcientymeh avatar Apr 27 '24 20:04 fcientymeh

Hi @ashwin-pc and @kavilla , should we mark this PR for 2.15?

BionIT avatar Jun 05 '24 03:06 BionIT