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

js: Make language code handling more robust, add tests #983

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

ix5
Copy link
Member

@ix5 ix5 commented Jan 19, 2024

Checklist

  • All new and existing tests are passing
  • (If adding features:) I have added tests to cover my changes
  • (If docs changes needed:) I have updated the documentation accordingly.
  • I have added an entry to CHANGES.rst because this is a user-facing change or an important bugfix
  • I have written proper commit message(s)

js: Make lang code handling more robust in config

Differing internal representations of two-level language codes, e.g. pt_BR/pt_PT or zh_CN/zh_TW, would lead to inconsistencies when combined with overrides of i18n strings for templating.

E.g. setting data-isso-lang=pt_BR and data-isso-postbox-text-text-PT_BR=foo would result in an internal representation of data-isso-postbox-text-text-pt-br (note: lowercase) and thus user-supplied i18n strings not being applied.

To make this handling more robust, convert everything into lowercase and substitute underscores for dashes.

Fixes #982

js: test/unit: Add testing for i18n overrides

Add jest tests

Differing internal representations of two-level language
codes, e.g. pt_BR/pt_PT or zh_CN/zh_TW, would lead to
inconsistencies when combined with overrides of i18n strings
for templating.

E.g. setting data-isso-lang=pt_BR and
data-isso-postbox-text-text-PT_BR would result in an
internal representation of data-isso-postbox-text-text-pt-br
(note: lowercase) and thus user-supplied i18n strings not
being applied.

To make this handling more robust, convert everything into
lowercase and substitute underscores for dashes.

Fixes isso-comments#982
@ix5 ix5 added client (Javascript) client code and CSS bug labels Jan 19, 2024
@ix5 ix5 added this to the 0.14 milestone Jan 19, 2024
ix5 added a commit to ix5/isso that referenced this pull request Jan 19, 2024
@ix5 ix5 mentioned this pull request Jan 19, 2024
3 tasks
@ix5 ix5 merged commit c9b1a1c into isso-comments:master Jan 22, 2024
3 checks passed
@ix5 ix5 deleted the i18n-templates branch January 22, 2024 20:34
@ix5 ix5 modified the milestones: 0.14, 0.13.1 May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug client (Javascript) client code and CSS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pt_BR override translation not working
1 participant