Skip to content

Instantly share code, notes, and snippets.

@Lupusa87
Last active August 15, 2019 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lupusa87/d1494b57bdbc678c227003d265e9a863 to your computer and use it in GitHub Desktop.
Save Lupusa87/d1494b57bdbc678c227003d265e9a863 to your computer and use it in GitHub Desktop.
Multi language interface support in client side blazor
@Lupusa87
Copy link
Author

I want to describe task I am working now.
I am adding multi language interface support to my blazor todos app. (https://lupblazortodo.z20.web.core.windows.net)
I do not use localization!
All data will be stored in Database (cosmosdb), there are 3 docs: languages, native words, translated words.
Native/original words (in this case English) are list of all words/sentences used in applications interface.
Translation can be sourced by human or automaticaly by translation api (google or azure).
For now I use google translator api for automatic translations but could be used azure service too by whom it will prefered.
There is translator library referenced in blazor app which is translating interface to selected language and if native words list does not have any requested word it is adding and translating automaticaly, so we do not need to do any manual work on server data or anywhere.
Blazor displays list of available languages (more than 100), if any new language is requested, server (azure function) will add this language to cosmosDB languages and will translate all native words/sentences and save them.
Blazor will display all words/sentence pairs (native - translate) and any user can suggest better translation for each pair, if it will be accepted by admin translated doc will change flag from automatic to human.
In result we get all google supported languages available as app interface, data are stored in DB and when client selects any other language than native/original all translated words/sentences will be downloaded and stored in client side browser's IndexDB. If server version for particular language will be updated (triggered by any change in translated docs) indexedDB will be synced.
This functional can be separated and made available as nuget package.
Now there is done about 60% of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment