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

[feature] Implement get text like translations #235

Closed
codesankalp opened this issue May 18, 2021 · 3 comments · Fixed by #287
Closed

[feature] Implement get text like translations #235

codesankalp opened this issue May 18, 2021 · 3 comments · Fixed by #287
Assignees
Labels
enhancement New feature or request Important

Comments

@codesankalp
Copy link
Member

codesankalp commented May 18, 2021

Implement get a text like translations: right now translations have to be defined in the configuration file of each organization, repeating the same text over and over, we should avoid this and store the translations in a central place;

However, being able to customize the text for each organization is a great feature and should still be possible if needed.

@codesankalp codesankalp added the enhancement New feature or request label May 18, 2021
@codesankalp codesankalp self-assigned this May 18, 2021
@nemesifier
Copy link
Member

I'd like to ask suggestions from @R9295 with whom I am working on some other project in which we used https://ttag.js.org/ to do this.

Aarnav, here we'll need to do the same thing, with the difference that texts can be overridden by configuration if needed.
If you have any suggestion or recommendation, let us know!

@R9295
Copy link
Member

R9295 commented Jun 4, 2021

Since there is an express backend, you could lazy load the files that ttag needs (.po.json) depending on the locale, which is ideal. I will think a bit more about dynamic po file generation based on the config.

@nemesifier
Copy link
Member

nemesifier commented Jun 7, 2021

What if we define all strings as placeholders and then have po files for each language, including english?
We could then tweak the code to look for custom po files first, and if the customized versions are found the default po files are ignored.

For example, by default the build process could look for:

  1. {languagecode}_{organization_slug}.custom.po
  2. {languagecode}.custom.po
  3. {languagecode}.po

By default option 1 and 2 will not be provided, but users of this app can prepare a custom po file with different wording if needed (either a general one or one for a specific organization).
That means that by default, option 3 is used.

It would be great if we could allow the custom po files to not be complete duplicates of the original po file, so users would only define the custom strings, this will make it a lot easier to maintain over time.
This could be achieved in the build process by inheriting the translations from the standard files, for example:

  • build processes es.po
  • if build finds a es.custom.po it compiles it (generates a JSON file with translations and then merges this result on top of es.po)
  • if build finds a es_myorg.po it repeats the same process but using as a base the content from es.custom.po

codesankalp added a commit that referenced this issue Jun 28, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jun 28, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jun 28, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jun 29, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 4, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 5, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 11, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 12, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 13, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 13, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 14, 2021
Used ttag js to implement get text like translations.

Closes #235
codesankalp added a commit that referenced this issue Jul 19, 2021
Used ttag js to implement get text like translations.

Closes #235
nemesifier pushed a commit that referenced this issue Jul 20, 2021
- gettext like translations with po files
- possibility to add custom translations (by language and by organization)
- auto detection of user preferred language

Closes #235
Closes #304
Closes #308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Important
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants