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

Sweep of en-US.JSON file to make sure repeat strings are minimized #511

Closed
2 tasks done
andrewtavis opened this issue Oct 26, 2023 · 8 comments
Closed
2 tasks done
Assignees
Labels
-priority- High priority help wanted Extra attention is needed localization Add or correct localizations

Comments

@andrewtavis
Copy link
Member

Terms

Description

This issue is to go through the en-US.json and combine as many strings as possible in order to make sure that when localization happens we don't have a bunch of repeats that the translators need to translate. The styleguide should also be updated with any new rules thought up to keep repeat values to a minimum :)

@andrewtavis andrewtavis added help wanted Extra attention is needed -priority- High priority localization Add or correct localizations labels Oct 26, 2023
@andrewtavis
Copy link
Member Author

I'll look into this a bit starting now, but ideas and feedback are very welcome!

@andrewtavis
Copy link
Member Author

andrewtavis commented Oct 28, 2023

Something that we'll likely need to do is create a common key that can be moved up into higher levels of the JSON tree. An idea would be _common, with an example being the following where for ChangeAccountInfo we're always asking the user to enter their in all sub components:

"card-change-account-info": {
    "_common": {
      "enter-your-password": "Enter your password",
      ...
    },
    "email": {
      "enter-new-email": "Enter new email",
      "enter-old-email": "Enter old email",
      ...
    },
    "password": {
      "enter-current-password": "Enter current password",
      "enter-new-password": "Enter new password",
      ...
    }
}

Putting the underscore at the front would put these at the start of the i18n JSON file sub-trees :)

@andrewtavis
Copy link
Member Author

Ping @ahmedy00, @felipolis and @luuu-xu: could I ask for opinions on the syntax mentioned in the comment above? The purpose here is to try to avoid having repeat keys in each component. We could also have a _common key at the highest level of the JSON tree to have strings that we're using in multiple different contexts 🤔

@andrewtavis
Copy link
Member Author

Checked this with @momanyisamuel and we're in agreement that this makes sense 😊 Another thing that's being added into this is if we're using the same string on the same page for two different functions then we can list those functionalities in alphabetical order :) So we'll have header-title for some keys just to make sure that we're not assigning a header to a title and calling it good. I also have the updates to the style guide done already locally, so this should hopefully be done before the sync on Saturday!

@andrewtavis
Copy link
Member Author

ec79bc5 is a major change to the i18n en-US.json file: I flattened the JSON. Reason for this is that I've been struggling trying to do all the renaming that we need to do to make sure that we have repeat strings under the _common sub levels. Obviously now we don't get the structure that shows what's being used where, but keeping the file alphabetized will do the same. Specifically the very important thing is that we can find and replace over the code base to replace keys now. Before I was having to find the string that needed to be combined, figure out it's full string by combining the JSON sub object path, and then find and replace - this with multiple versions of some the strings. I eventually gave up 😅 I'll get to this using this new method after the sync.

@andrewtavis
Copy link
Member Author

I also added find_repeat_i18n_values.py that we can use to do periodic checks of the i18n keys and combine them if there are repeats. We can also maybe add this into a workflow at some point 🤔

@andrewtavis
Copy link
Member Author

Based on some work in #519, I think we should go with a sub-name of _global instead of _common now :)

@andrewtavis
Copy link
Member Author

Closed via 8340e0f 🌐🚀 I'll do a commit in the coming days that updates the strings that are not a bit out of order, but we now have a great process for checking the strings via #530 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-priority- High priority help wanted Extra attention is needed localization Add or correct localizations
Projects
Archived in project
Development

No branches or pull requests

1 participant