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

Fix i18n files keys sort #14433

Merged
merged 5 commits into from May 9, 2019
Merged

Fix i18n files keys sort #14433

merged 5 commits into from May 9, 2019

Conversation

sampaiodiego
Copy link
Member

Added an script to do that as well.

@mrsimpson what do you think?

@sampaiodiego sampaiodiego added this to the 1.0.3 milestone May 8, 2019
Copy link
Collaborator

@mrsimpson mrsimpson left a comment

Choose a reason for hiding this comment

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

The result looks fine, I also like the idea of using a source language as "sorting template". However, I consider removing non-existent keys at least as "dangerous".

Would you add a script in the package.json (translation-fix) as well?

*
* - remove any duplicated i18n key on the same file;
* - re-order all keys based on source i18n file (en.i18n.json)
* - remove all keys not present in source i18n file
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have seen cases where a "translation" was not maintained in English for single words, where the key is fine as fallback (like _ "ok").
In those cases, I had to add a translation which did not exist in EN. => Until there's a verification that all keys contain a translation in EN, I'd not remove the translations

Copy link
Collaborator

Choose a reason for hiding this comment

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

replying to myself: if someone figures out a translation was missing in EN (but the key was used as display text), he/she/it should add the translation to the EN file anyway. I've done the same earlier on as well and now it seems as if there were no translations missing in EN. => Imho, this is fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes.. also, if some translation is missing from EN nobody will be able to translate it from lingohub, and on the next export from lingohub it would be removed from any other language as well.. so this just implements lingohub's behavior

* - remove all keys not present in source i18n file
*
* you might need to do:
* npm i --no-save fast-glob
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not add it as a dev dependency?


const json = JSON.parse(fs.readFileSync(file, 'utf8'));

fs.writeFileSync(file, `${ JSON.stringify(json, sourceKeys, 2) }${ newlineAtEnd ? '\n' : '' }`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't know the feature of the replacer as whitelist in stringify. A comment might help, but it may be an individual incompetence of myself in this area ;)

@mrsimpson mrsimpson self-requested a review May 8, 2019 21:35
mrsimpson
mrsimpson previously approved these changes May 8, 2019
Copy link
Collaborator

@mrsimpson mrsimpson left a comment

Choose a reason for hiding this comment

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

Re-thinking my concerns I came to the conclusion that also deleting keys is fine.
Btw: There's already a script translation-diff which compares the keys independent of order.

@sampaiodiego
Copy link
Member Author

thanks @mrsimpson .. I was not willing to add it as an "official script", that's why I haven't added a script entry nor added to dev dependencies.. but now I guess I should.. 😛 I'll update the PR doing it.. thx

ggazzo
ggazzo previously approved these changes May 9, 2019
@sampaiodiego sampaiodiego merged commit f17763f into develop May 9, 2019
@sampaiodiego sampaiodiego deleted the fix-i18n-files branch May 9, 2019 20:23
rodrigok pushed a commit that referenced this pull request May 9, 2019
* Add script to normalize i18n files

* Fix i18n files

* Set as official script

* Update package-lock.json
@rodrigok rodrigok mentioned this pull request May 9, 2019
rodrigok added a commit that referenced this pull request May 10, 2019
* [FIX] New day separator overlapping above system message (#14362)

* Improve German translations (#14351)

* Use the plural for discussions-section in side panel

* Formal and informal translations for 1.0

* fix german typos

* [FIX] Main thread title on replies (#14372)

* fix

* fix test

* fix setting

* Update tests/pageobjects/main-content.page.js

Co-Authored-By: ggazzo <guilhermegazzo@gmail.com>

* Update app/ui-utils/client/lib/RoomHistoryManager.js

Co-Authored-By: ggazzo <guilhermegazzo@gmail.com>

* [FIX] Bell was too small on threads (#14394)

* [FIX] Messages on threads disappearing (#14393)

* fix subscription-changed updating all messages(#14391)

* Fix: Message body was not being updated when user disabled nrr message (#14390)

* [NEW] Allow change Discussion's properties (#14389)

* [FIX] Unnecessary meteor.defer on openRoom (#14396)

* [FIX] more message actions to threads context(follow, unfollow, copy, delete) (#14387)

* added more message actions to threads context

* more actions

* change token name (#14379)

* [FIX] Pressing Enter in User Search field at channel causes reload (#14388)

* Prevent default on enter in User search

* Prevent form submission in membersList

* If using subpath make sure streams use that also for multi-instance.  Fixes #13200 (#14376)

* Revert "[IMPROVE] Use SessionId for credential token in SAML request (#13791)" (#14345)

This reverts commit 3967a74.

* Add fallback to mongo version that doesn't require clusterMonitor role (#14403)

* [FIX] Users actions in administration were returning error (#14400)

* Fix actions collapse into popup in userInfo

* Refactor userActions

* [FIX] Error 400 on send a reply to an old thread (#14402)

* fix error 400 on send a reply to an old thread

* ignoring properly hidden messages

* [FIX] Messages on thread panel were receiving wrong context/subscription  (#14404)

* [FIX] preview pdf its not working (#14419)

* [FIX] renderMessageBody was caching messages in wrong scenarios #14420

* LingoHub Update 🚀 (#14426)

Manual push by LingoHub User: Diego Sampaio.
Project: Rocket.Chat

Made with ❤️ by https://lingohub.com

* [FIX] Mentions message missing 'jump to message' action (#14430)

* fixed context

* threads context

* [FIX] Escape unrecognized slash command message (#14432)

* Add missing german translations (#14386)

* [FIX] IE11 support (#14422)

* Add symlinks to ES6 node_modules imports

* Add URL polyfill for IE11

* Fix thread replies for IE11

* [IMPROVE] allow users to skip activeUsers to be ready (#14431)

* allow users to skip activeUsers to be ready

* Update main.js

* Update app/ui-master/client/main.js

Co-Authored-By: ggazzo <guilhermegazzo@gmail.com>

* [IMPROVE] Don't use regex to find users (#14397)

* Don't use regex to find users

* Invert logic on model methods

* Escape username regex

* Find users in batch

* Use only normalizeMessagesForUser

* Don't ignore username case to get owners on graphql

* Fixes on DAU and MAU aggregations (#14418)

* Fixes on SAU and MAU aggregations

* Report new data from DAU/MAU

* Run tests agains a mongodb container in CI

* Try to run CI correctly

* Fix drop database

* Parse desktop app User Agent correctly

* Fix aggregation of past sessions

* Return past month today

* Fix bug

* Add migration

* Fixed migration

* Migration improvements

* Fix crowd sync by using correct logging method (#14405)

* Fix room names in user info dialogs (#14415)

* Fix discussion name being invalid (#14442)

Closes #14378

* Fix i18n files keys sort (#14433)

* Add script to normalize i18n files

* Fix i18n files

* Set as official script

* Update package-lock.json

* fix (#14443)

* Update threads.css

* Bump version to 1.0.3

* regen changelog
@sampaiodiego sampaiodiego mentioned this pull request May 28, 2019
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.

None yet

4 participants