activist
activist copied to clipboard
Standardize i18n keys
Terms
- [X] I have searched all open bug reports
- [X] I agree to follow activist's Code of Conduct
Behavior
Something that came up recently is that the i18n keys are not standardized - i.e. sometimes we have kebab case or snake case. This issue is to check the keys and change them all to either snake case or camel case, with the reason for this being that we want to be able to easily replace full sections of the key.
@andrewtavis I came upon your issue by chance. What we are currently discussing internally in our team might also be of interest to you. Simply use human readable and random ids and let the tooling generate them. This will solve many problems
https://github.com/opral/monorepo/issues/1892
hi @andrewtavis! I would like to help with this issue, is it still available?
Hey @jennethydyrova π If you wanted to send along a PR that converts all of the kebab case to snake case, it'd be much appreciated!
Let me know if there's anything I can do to help :) I'll also send along a commit to this that will make a check to see if the keys can be effectively combined. We did discuss this a bit internally, and feel that the current system is valid as it allows the localization team to easily filter for parts of the app π
I just wondered if would it be fine if I send all changes in one PR or would it be easier for you to review if I split it to multiple PRs?
I guess one PR would be easier as that would allow me to plan around it, bring in some others, and then merge it all at once and not need to deal with conflicts soon after that π
Thanks so much for asking!
I've got one more question. According to style guide folder names should be separated by dash
Localization keys should be defined based on their component or page within the platform and the content that they refer to (CONTENT_REFERENCE below). Please use the following rules as a guide if you find yourself needing to create new localization keys: Separate directories and references by . and CamelCase file name words by - in keys Ex: "components.search-bar.CONTENT_REFERENCE" for the SearchBar component
then, for example, components.btn-action.save-settings key should be renamed to components.btn-action.save_settings, is that right?
Glad to have you working on this, @jennethydyrova! Looks like the styleguide needs to be updated as well. Let's use underscores for the whole thing. That was a poor choice by us earlier :)
Would you be able to send along an update to the styleguide with this as well?
yes, sure! π
Thank you, @jennethydyrova!
Closed by #948 π Lots of work to get through this, @jennethydyrova, but with the new workflow we won't have to worry about naming keys anymore except for an identifier at the end for a hint for context. The prior parts of the key are based on the files in which it's used, and the new workflows will suggest corrections for those as we go π
Thanks so much for the contribution!
Closed by #948 π Lots of work to get through this, @jennethydyrova, but with the new workflow we won't have to worry about naming keys anymore except for an identifier at the end for a hint for context. The prior parts of the key are based on the files in which it's used, and the new workflows will suggest corrections for those as we go π
Thanks so much for the contribution!
Thank you, Andrew!
While addressing this issue, I noticed that the components.meta-tag-video.view-video key is utilized in frontend/components/card/search-result/CardSearchResult.vue, but it doesnβt seem to be defined in frontend/i18n/en-US.json. This might be something worth looking into.
Good catch, @jennethydyrova :) That's likely just a placeholder, but definitely should be removed at some point. Do you want to do a quick PR to fix it?
Good catch, @jennethydyrova :) That's likely just a placeholder, but definitely should be removed at some point. Do you want to do a quick PR to fix it?
yes, sure! do you want this tag to be removed from labels?
Hmmm, good question :) Let's actually add it in. So this key's only in CardSearchResult, so based on the naming conventions we should change the instances of components.meta-tag-video.view-video to components.card_search_result.view_video, and then we can add this key and View video as it's value to the en-US i18n keys? How does this sound? You can link the PR to this issue, btw π
hi, @andrewtavis! all done https://github.com/activist-org/activist/pull/966