This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
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.
Description
This is at attempt to create internationalization / translation for the browser by adding a localization i18n library and browser language detector, based on this improvement issue: Add internationalization #1935.
User story
As a Blockstack user, I would like to change the to my preferred language either in Settings or in a navigation bar quick access menu. Automatic language switch is done (if available) based on i18next-browser-languageDetector or on querystring
${ROOT_URL}?lng=LANG
. The fallback language is English.The following packages have been installed:
i18next is an improvement of i18n (which has been there for 11 years). It has more versions, fewer dependencies, more daily downloads, more weekly downloads, more monthly downloads, fewer open issues and fewer open pull requests. react-i18next has more frequent updates.
Affected code paths
The following two directories with the appropriate files were created, English, fallback and French as an example.
The
i18n.js
is the config file in theapp/js
directory. It specifies the configuration options of localizations, such as:Two ways to create a localization of the component in react:
i18n.js
config file and by wrapping the string ini18n.t('translatable_string')
. Thetranslatable_string
must be a string and have a reference to in on the translation json files.withTranslation()
and then (checking PropTypes) import functiont
using propsRecommendation
One recommendation is to get
allApps
label
key as a keyword, such as social_impact, or document_storage and not as a full string. It could then be referenced in the translation file and translated. Currently these labels come back in English, see img attached below.For details refer to issue #1935
Type of Change
Are documentation updates required?