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

Add missing i18n keys #2092

Merged
merged 3 commits into from
May 13, 2021
Merged

Add missing i18n keys #2092

merged 3 commits into from
May 13, 2021

Conversation

callumknights
Copy link
Contributor

@callumknights callumknights commented Apr 27, 2021

Adds missing locales.

More info in the commits ->

Trello: https://trello.com/c/kYXvexWo/2455-add-missing-keys-to-locale-files-3

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

@bevanloon bevanloon temporarily deployed to government-f-add-missin-jsnspv April 27, 2021 15:44 Inactive
@callumknights callumknights changed the title Add and configure 'i18n-tasks' gem Ad missing i18n keys Apr 27, 2021
@callumknights callumknights changed the title Ad missing i18n keys Add missing i18n keys Apr 27, 2021
@bevanloon bevanloon temporarily deployed to government-f-add-missin-jsnspv April 27, 2021 15:49 Inactive
@bevanloon bevanloon temporarily deployed to government-f-add-missin-jsnspv April 27, 2021 16:24 Inactive
@bevanloon bevanloon temporarily deployed to government-f-add-missin-jsnspv April 30, 2021 17:15 Inactive
callumknights and others added 2 commits May 11, 2021 10:11
Sort language keys alphabetically for easier comparison when missing keys are added.
`i18n-tasks add-missing -v` used to generate missing foreign keys that
are present in the base locale (en). Some parsing was needed after which
removed any inserted whitespace characters.
@1pretz1 1pretz1 force-pushed the add-missing-keys branch from e6be726 to e8bd21d Compare May 11, 2021 09:11
Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@@ -1,8 +1,21 @@
---
ar:
common:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Some parsing was needed after which removed any inserted whitespace characters."

What parsing was that? (just out of interest, as I always found it quite odd that i18n-tasks adds spaces to the keys it creates).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I found it strange too. I had to do two extra bits of parsing during this work for the keys added by the add-missing command.

The first was to delete all key values assigned by i18n-tasks add-missing -v <some-value>. I couldn't get the command to input blank values and so had to pass it an arbitrary value and then do a global delete.

The command below achieved this:

LC_ALL=C find <path-to-locales> -type f -exec sed -i '' -e ’s/<some-value>//g’ {} \;

Running add-missing also inserted lots of whitespace, annoyingly. Similarly to before I then did a global delete using perl:

find <path-to-locales> -type f -print0 | xargs -0 perl -pi -e 's/ +$//'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice bit of bash hackery there 👍 I think it's nice that you've removed the spaces, though not a deal-breaker if we'd have left them in.

Missing keys autogenerated in the last commit didn't have appropriate
pluralization keys for each language as they were simply copied from the
base locale (en) - `one` & `other`. This commit adds or removes keys
specific to the locale. Work to define each language's pluralization
keys was done prior [1] [2] and so we could just copy the rules per set
added.

[1]: 2a81e71
[2]: 16fd6f6
@1pretz1 1pretz1 force-pushed the add-missing-keys branch from e8bd21d to a461457 Compare May 12, 2021 10:53
@1pretz1 1pretz1 merged commit c8e102f into main May 13, 2021
@1pretz1 1pretz1 deleted the add-missing-keys branch May 13, 2021 09:11
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.

4 participants