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

Implement Multi-Language support #113

Merged
merged 9 commits into from
Jul 15, 2021
Merged

Implement Multi-Language support #113

merged 9 commits into from
Jul 15, 2021

Conversation

ndegwamartin
Copy link
Collaborator

@ndegwamartin ndegwamartin commented Apr 27, 2021

Closes #69

Copy link
Owner

@ellykits ellykits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General question: Can the translations work with properties provided from another source other than loading them from the resources directory? For the forms, you can build from a file in the assets or from a String source which can be stored in any place hence the reasons for having 2 constructors for the form builder. One accepts name of file in the assets directory whereas the other uses the JSON string provided.

@ellykits
Copy link
Owner

ellykits commented May 16, 2021

  • I noticed the options for the dropdown widget were not picking the values correctly (This is before switching device language)

screenshot-2021-05-17_00 38 00 645

@ellykits
Copy link
Owner

The form was NOT translated when I changed device language to Kiswahili (both Tanzanian and Kenyan dialect). French translation works but appears the skip logic applied via the rules is affected. My thinking is it maybe referencing actual text instead of the keys for the options. That can be corrected.

@ellykits
Copy link
Owner

@dubdabasoduba Can you review this? I am gonna assign you to it as well. Thanks.

@codecov
Copy link

codecov bot commented May 17, 2021

Codecov Report

Merging #113 (b752355) into master (1cc1354) will decrease coverage by 0.10%.
The diff coverage is 62.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #113      +/-   ##
============================================
- Coverage     75.01%   74.91%   -0.11%     
- Complexity      422      425       +3     
============================================
  Files            40       41       +1     
  Lines          1429     1443      +14     
  Branches        321      321              
============================================
+ Hits           1072     1081       +9     
- Misses          110      115       +5     
  Partials        247      247              
Impacted Files Coverage Δ
...mcore/utils/internationalization/LanguageHelper.kt 50.00% <50.00%> (ø)
...erdstone/neatformcore/form/json/JsonFormBuilder.kt 80.23% <70.00%> (-0.54%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1cc1354...b752355. Read the comment docs.

@ndegwamartin
Copy link
Collaborator Author

The form was NOT translated when I changed device language to Kiswahili (both Tanzanian and Kenyan dialect). French translation works but appears the skip logic applied via the rules is affected. My thinking is it maybe referencing actual text instead of the keys for the options. That can be corrected.

We had configured the translation with the incorrect locale suffix. For Swahili should be sw instead of swa. More on locales and valid language codes can be found here. I'll add this link to the README as well

@ndegwamartin
Copy link
Collaborator Author

General question: Can the translations work with properties provided from another source other than loading them from the resources directory? For the forms, you can build from a file in the assets or from a String source which can be stored in any place hence the reasons for having 2 constructors for the form builder. One accepts name of file in the assets directory whereas the other uses the JSON string provided.

Depends on how we'd want to implement this e.g.

  • Would we want to store that json string form as already translated?
  • If not, are the translations also provided alongside it?

@ellykits
Copy link
Owner

Depends on how we'd want to implement this e.g.

  • Would we want to store that json string form as already translated?
  • If not, are the translations also provided alongside it?

I assume the translations will be provided alongside the form, that way we go with second option as it is more flexible.

@ellykits
Copy link
Owner

@ndegwamartin Can you update spinner widget and any other widget with options that is saving the label instead of the key for the option. This is affecting rules processing in a multilanguange setup. E.g if the rule is declared to use the default language label, it will not work for other languages. This is reproducible on the Spinner. Debug this method com.nerdstone.neatformcore.rules.RulesFactory#updateFactsAndExecuteRules and see the value that is passed (should be option key instead. I have not tested for radio groups/multi choice checkboxes.

@ellykits
Copy link
Owner

The form was NOT translated when I changed device language to Kiswahili (both Tanzanian and Kenyan dialect). French translation works but appears the skip logic applied via the rules is affected. My thinking is it maybe referencing actual text instead of the keys for the options. That can be corrected.

We had configured the translation with the incorrect locale suffix. For Swahili should be sw instead of swa. More on locales and valid language codes can be found here. I'll add this link to the README as well

Did you push the fix for Swahili translation? I see the file extension is still the same in your last commit.

@ellykits
Copy link
Owner

Also remember to increment the app version in the README/build.gradle file. I will remove Bintray configs in another commit, for now we can work with GitHub Package Registry.

@ndegwamartin
Copy link
Collaborator Author

Depends on how we'd want to implement this e.g.

  • Would we want to store that json string form as already translated?
  • If not, are the translations also provided alongside it?

I assume the translations will be provided alongside the form, that way we go with second option as it is more flexible.

If we pick the second option I think we'd then need to modify the constructor to accept an optional language translation file (or content)

@ellykits
Copy link
Owner

ellykits commented May 17, 2021 via email

@ellykits
Copy link
Owner

@ndegwamartin I experienced app crash in Android version 10
screenshot-2021-05-25_16 25 32 762

Error logs

2021-05-25 16:20:45.333 3412-3412/com.nerdstone.neatform W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@b5ec994
2021-05-25 16:20:45.417 3412-3412/com.nerdstone.neatform E/CustomExceptions$$special$$inlined$CoroutineExceptionHandler: CoroutineExceptionHandler got java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference

@ellykits
Copy link
Owner

I have opened the new issue for fixing the issue with the spinner skip logic. This is good to go 👍

@ndegwamartin ndegwamartin merged commit dd3f158 into master Jul 15, 2021
@ndegwamartin ndegwamartin deleted the 69-mls-support branch July 15, 2021 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Multi language support
3 participants