Skip to content

Localization Client

Danylo Lytvynenko edited this page Feb 8, 2021 · 7 revisions

You can use this plugin as a localizer for your project. By filling in Google spreadsheet with the necessary phrases, you can get these phrases in your project using LocalizationClient. Here are the steps to get you going.

Google spreadsheet

First of all, you need to configure your Google spreadsheet. Your first line should be filled with headings, namely Token in the first place, and then EN, Japanese and other languages. Then fill in the given titles, respectively. Example

image

Adding your Localization spreadsheet

After the spreadsheet is ready, you need to add it to your project. For this:

  1. Go to the Spreadsheet tab. And add your spreadsheet ID

image

  1. After loading spreadsheet, go to the tab Localization

image

  1. Choosing the spreadsheet you need

image image

  1. Information about the spreadsheet

image

Let's create Localization Client the first

var client = new LocalizationClient();
var client = new LocalizationClient(defaultLangCode, currentLangCode); // defaultLangCode -  default language, currentLangCode -  current language

List of Available translation languages

var langs = client.Languages; //"EN", "RU", "HZ", "FR"

Get "HZ" phrase for the "Mytoken" token

 client.SetLanguage("HZ");
 var phrase = client.GetLocalizedString("Mytoken");

Get phrase in Upper Case for the "Mytoken" token

 var phrase = client.GetLocalizedString("Mytoken", TextType.ToUpper);

Get phrase for the "Mytoken" token from "General" sheet

 var phrase = client.GetLocalizedString("Mytoken", "General");

Get phrase in each word with capital for the "Mytoken" token from "General" sheet

 var phrase = client.GetLocalizedString("Mytoken", "General", TextType.EachWithCapital);

Get phrase with capital for the "Mytoken" token from "General" sheet. And insert the "Family", "together" in a phrase "{0} joined {1}. Welcome!"

 var args = new[]{"Family", "together"});
 var phrase = client.GetLocalizedString("Mytoken", "General", TextType.EachWithCapital, args );