Skip to content

Localization - source of truth and settings#27

Merged
BartoszKlonowski merged 8 commits intomainfrom
feature-internationalization
Jul 7, 2021
Merged

Localization - source of truth and settings#27
BartoszKlonowski merged 8 commits intomainfrom
feature-internationalization

Conversation

@BartoszKlonowski
Copy link
Copy Markdown
Member

This pull request closes #21

It delivers the full functionality of the localization in the application interface.


The implementation contains:

  • one source of truth containing the index of used dictionary of selected language
    The implementation of the source of truth is based on the Database native 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.
  • Localized string resources as JSON files
  • Settings screen with language selection widget
    The settings screen contains the <Picker/> control.
    It can be replaced with more stable control as the Picker can be deprecated at some point.
  • All texts replaced with implemented Dictionary API
    The 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 getTextByKey function which is able to return the resource given as key in the language pulled from settings.

So the results are as presented below:
README-notes-i18n

For more information please check the commit messages.

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.
@BartoszKlonowski BartoszKlonowski added enhancement New feature or request C++ Topic relates to the C++ native code JavaScript Topic relates to the JS or React Native code labels Jul 6, 2021
@BartoszKlonowski BartoszKlonowski merged commit 2f7d6d2 into main Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ Topic relates to the C++ native code enhancement New feature or request JavaScript Topic relates to the JS or React Native code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internationalization - string resources and settings

1 participant