-
Notifications
You must be signed in to change notification settings - Fork 78
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
LF-4400 Add new languages to i18n framework #3409
LF-4400 Add new languages to i18n framework #3409
Conversation
This commit integrates the useLanguageOptions hook contributed by @mvavrovic in PR #3223 and adds the 3 other new LiteFarm languages to it. Co-authored-by: mvavrovic <[email protected]>
The other new languages aren't supported by this package
These were meant to be <target-lang>/<lang-code> but were all translated as English :)
@kathyavini from yesterday's all team standup, I thought Divya's intention was to be able to release some of the new languages first, even if the others are not ready yet. This patch would actually introduce all the new languages as options to the UI, so we would be releasing all of them or none of them, is that correct? If that's the case you might want to check with her to see if we want to have a "partial" patch ready instead. |
@@ -12,7 +12,7 @@ i18n | |||
defaultNS: 'translation', | |||
nsSeparator: ':', | |||
fallbackLng: 'en', | |||
locales: ['en', 'pt', 'es', 'fr'], | |||
locales: ['en', 'pt', 'es', 'fr', 'de', 'hi', 'pa', 'ml'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we get the array of languages here and in the i18next-parser
file from the supportedLanguages
array? I love how you minimized having to have a list of the languages in a thousand places and thinking if we could extend that further.
@@ -4,7 +4,7 @@ import Backend from 'i18next-fs-backend'; | |||
i18n.use(Backend).init( | |||
{ | |||
fallbackLng: 'en', | |||
preload: ['en', 'es', 'pt', 'fr'], | |||
preload: ['en', 'es', 'pt', 'fr', 'de', 'hi', 'pa', 'ml'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have an array of languages somewhere on the api side like you did on webapp, so that we don't have to alter that many files next time we add a new language?
@@ -9,6 +9,7 @@ import { getNewDate } from '../Form/InputDuration/utils'; | |||
import 'rc-year-calendar/locales/rc-year-calendar.es'; | |||
import 'rc-year-calendar/locales/rc-year-calendar.pt'; | |||
import 'rc-year-calendar/locales/rc-year-calendar.fr'; | |||
import 'rc-year-calendar/locales/rc-year-calendar.de'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need a PR to either find a new Calendar package or add these files to our locales then copy them to node_modules to augment package. Thanks for doing that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great ! Thanks and feel free to merge.
Double thanks to @mvavrovic ! Appreciate your help getting German in and the release to be supported very soon!
Thank you for both your comments! I've merged so we can start getting QA on the language release ASAP, but we should have time to refine as we prioritize the upcoming language tickets. (Update: ticket now here: LF-4424 Improve efficiency of adding new languages to LiteFarm) @antsgar as I understood it, Divya was asking us was whether we could start building out the language feature/release without waiting for all the Malayalam translation work to complete. German and Malayalam are the two languages required by our research partners (Hindi and Punjabi were the nice-to-haves) so I don't think actually releasing to prod without Malayalam could ever occur -- although in a pinch I guess we could comment it out if it truly doesn't complete. Should not be necessary though -- I see progress in CrowdIn for Malayalam now. |
Description
This PR adds core support for the four new languages (German, Hindi, Punjabi, and Malayalam) to LiteFarm.
In all places where the new languages could be incorporated without significant refactor, they have been added to this PR. For all other cases, I am opening separate tickets to resolve or investigate. Places where the language codes could be added without refactor are:
locales
arrays of i18n configuration itselfuseLanguageOptions
hook, see below)src/jobs/locales
folder for the export serverAdditionally:
DEFAULT_LANGUAGE
&DEFAULT_LANGUAGE_VALUE
were intended to refer to the target language, but were instead supplied as translations of "English" in all the contributed languages; I have fixed that here and on CrowdIn and added context on CrowdIn for future contributorsJira link: https://lite-farm.atlassian.net/browse/LF-4400
Attribution
The framework for this ticket comes from this PR by @mvavrovic (thank you!!!)
Because we are now using the CrowdIn system to normalize and organize translations, the translations portion of that PR was previously uploaded to CrowdIn using this branch:
and the remaining content -- the integregration with app, including the new
useLanguageOptions
hook -- is now contained within this PR.Type of change
How Has This Been Tested?
Checklist: