Localization - source of truth and settings#27
Merged
BartoszKlonowski merged 8 commits intomainfrom Jul 7, 2021
Merged
Conversation
There are currently two languages supported: en & pl, but thanks to decent architecture adding a new one is a matter of few LoC. ESLint had to be reconfigured to ignore JSONs, as they are in a subidrectory of src/ and would generate errors.
The Dictionary is a React.Component which displays any text given as a key (passed as `label` property) in a language selected previously by selection list. It can also accept styles as an object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request closes #21
It delivers the full functionality of the localization in the application interface.
The implementation contains:
The implementation of the source of truth is based on the
Databasenative module which acts like a database handler (context) in this system. The selected value of language is retained as the enumerated value which can be pulled to take a string resource.The settings screen contains the
<Picker/>control.It can be replaced with more stable control as the
Pickercan be deprecated at some point.DictionaryAPIThe API contains the
<Dictionary/>component as a main feature (should be used wherever possible due to safer approach to indexes and values handling).Also the
getTextByKeyfunction which is able to return the resource given as key in the language pulled from settings.So the results are as presented below:

For more information please check the commit messages.