[candidate_list] Translate candidate_list module#9797
Conversation
0a97362 to
4cc141e
Compare
|
|
||
| window.addEventListener('load', () => { | ||
| const args = QueryString.get(); | ||
| i18n.addResourceBundle('ja', 'candidate_list', jaStrings); |
There was a problem hiding this comment.
does this only get added if the user preference is japanese? if we were to add support for more languages, would each language bundle need to be added here?
There was a problem hiding this comment.
The resource bundle gets added for all users in the javascript but will only get used if the language is ja. We would need to add each language call here.
If we use a backend different loader than the json object resources way in i18next (ie if we used the http backend), there is an option to only load the used language, but since it's being compiled into the module's js here I don't think there's any reason to not just add the resources.
| msgid "Access Profile" | ||
| msgstr "" | ||
|
|
||
| msgid "Entity Type" |
There was a problem hiding this comment.
is there a way to combine these so that we have the msgid, and then have all the listed translations? Or is this the standard way to do it? It just seems that it would be easier to maintain with the msgids written once, rather than repeated across files.
There was a problem hiding this comment.
No, this is a standard way to do it. All the translations to the same language are grouped together, not all the different language translations for a given string.
|
Hey @driusan ! I was testing the PR out and noticed that some of the strings don't translate. I initially thought it might be a language issue so I tested it out using Hindi language as well. Could you kindly let me know if there is something I'm missing out for the translation of the marked strings? |
|
@SKADE2303 Thanks for testing this with another language! I'm able to reproduce so I'll look into it. "Access Profile" should definitely be translated, there seems to be a regression since #9747. I'll look into it and see about the other ones as well (I think the reason they're not being translated is because they're from core jsx components, not the module itself, but I can't remember if that was supposed to be done in this PR or not..) |
5aa7297 to
b8bffc0
Compare
|
@SKADE2303 It turns out there wasn't a regression but a typo in my language table (I had my language code set to ja-JP instead of ja_JP and it needs to match the systems..) now that I fixed it, it also turns out that that one breadcrumb was missed so it should be fixed in the latest commit. The other strings are coming from core jsx components, rather than the module's, and I think should be done in another PR. |
|
@SKADE2303 if the Breadcrumb isn't fixed in the latest commit can you check your language table and that the hyphenation of the language_code matches your system's in |
|
It ended up not being a huge amount of changes so I did the Filter/DataTable changes in this PR. It should be fully translated now (though you'll have to add a few more strings from the .pot to your Hindi translation..) |
racostas
left a comment
There was a problem hiding this comment.
- Hi @driusan, I tested this PR myself after @SKADE2303 comments and your additions.
There are some integrations tests that seems to be failing but functionality looks good ! Here an image of my test in Spanish:

If you can please check what is falling with the test / merge this PR ? @SKADE2303 is currently working in other translations but this PR offers infrastructure for them.
Thanks !
…dule is fully translated
… list module is fully translated" This reverts commit b467ce6.
3bd0e24 to
2975847
Compare
|
@racostas I reverted the changes to the DataTable so I can move it to another PR. It turns out that for the string to be translated all the entry points that use the DataTable need to be updated. |
This translates the candidate list module as an example of how to do localization of a loris module that is written in React with class based components. JSON files are generated from the same `.po` files used by the PHP side of file, which are then imported into the i18next resources. They are generated at compile time with the i18next-conv package. Modules (in this case candidate_list) must call the addResourceBundle method of i18next to add the strings which are specific to their module. This example uses the withTranslation HOC, but functional components can use the useTranslation hook instead.


This translates the candidate list module as an example of how to do localization of a loris module that is written in React with class based components.
JSON files are generated from the same
.pofiles used by the PHP side of file, which are then imported into the i18next resources. They are generated at compile time with the i18next-conv package. Modules (in this case candidate_list) must call the addResourceBundle method of i18next to add the strings which are specific to their module.This example uses the withTranslation HOC, but functional components can use the useTranslation hook instead.
Note that in this PR I only translated the strings from the candidate_list module itself used by the filters/headers to serve as an example. There are other strings which come from components in the
jsx/directory which are shared across all modules. Those will be in other PRs since they are a one-time effort for all modules.