Smart Localization Update

We’ve been working on Smart Localization for over three years now, and it’s been extremely fun and exciting for us to see our product being used in your games.
Supporting other languages can open up your game to a whole new audience that would never have played it otherwise - and we are glad that we could provide the tools for many of you to ease that process during the years.

Unfortunately, Smart Localization is a product that never gave us any economical safety - so we’ve developed it as a side project just for fun, alongside our respective full time jobs. It enabled us to buy coffee, and we’re eternally grateful for that ;)

In light of this, I regret to inform you that we have decided to discontinue the development of Smart Localization.

The PRO version will be taken down from the store today, but we have also put up the project open source on GitHub with an MIT-license which you can find here: https://github.com/NiklasBorglund/Smart-Localization-2

We are very sorry for the inconvenience. We’d would recommend that you start looking for other localization solutions for your projects. We’ve never tried it, but we’ve heard that I2 Localization should be very good: https://www.assetstore.unity3d.com/en/#!/content/14884

Posted on March 5, 2017 .

How to localize fonts in Smart Localization

To start localizing fonts in Smart Localization, you first need to create a key with a FONT type in the root language file. Don't forget to press save after you've made your changes.

After this, you need to set the fonts in your localized languages. You can accomplish this by enterting the Translation Window of the desired language. In this tutorial, I will add the Google Noto Sans font to Swedish.

To get the font from code, you can use the GetFont() method in the LanguageManager.

void MyFontRetrievalMethod()
{
    var myMainMenuFont = LanguageManager.Instance.GetFont("MainMenu.Font");
}

 

 

Setting the LanguageManager to persist between scenes

The LanguageManager singleton instance does not by default persist between scenes. So you need to set this by yourself.

To achieve this, you can use the static method in the LanguageManager class named SetDontDestroyOnLoad()

LanguageManager.SetDontDestroyOnLoad();

The reason for this is mainly of legacy reasons, but that might change in the future.

 

How to load the device language in Smart Localization

This is a code snippet on how to set Smart Localization to load the system language in the start method of a script.

The built in functions to detect the device language in Smart Localization is entirely based on Application.systemLanguage. That is an enum that only returns the language in plain english and no regional data. So, if you need better control over the device language - writing a native plugin for that is probably the best way to go.

Editor Scripting in Smart Localization: Getting Language Values and Keys

Getting your language values not just at runtime, but in the editor can be a valuable tool. Especially if you are creating an editor extension or another system that is based on Smart Localization and the values it produces.

This can be done with a method found in the static class LanguageHandlerEditor named LoadParsedLanguageFile.

If you want only the keys or the comments in the root language file - you can pass in null as the language code and true as the second parameter that indicates that this is the root file.

var rootValues = LanguageHandlerEditor.LoadParsedLanguageFile(null, true);

If you'd like to have the language values for a specific language - you pass in the language code of the language you want to load (i.e. "en" "sv" etc.") and false as the second parameter.

var languageValues = LanguageHandlerEditor.LoadParsedLanguageFile("en", false);



Appending and changing language data at runtime in Smart Localization

Waiting 6-10 working days for an approval to one of the app stores can be a tedious process - especially if you only want to do something like a minor update in a translation.

One way to circumvent this and push translations directly into your published game would be to create a system to store updates on a server and then checking if there’s an update at a timed interval in your game.

If you are a developer with a solution similar to the one described - we have the following methods that you can use to add/update your translations into the Smart Localization system.

Both of these methods are available in the LanguageManager class and they only take in data in the .resx format.

void ChangeLanguageWithData(string languageDataInResX, string languageCode);

This method clears the currently loaded language from the system and loads a new one with the specified .resx data and the accompanied language code.

bool AppendLanguageWithTextData(string languageDataInResX);

Append Language with Text Data takes the data in the resx data and appends it to your currently loaded language. If there’s duplicate keys, the new one will be chosen.

Posted on December 23, 2015 and filed under Smart Localization.

How to use Microsoft Translator with Smart Localization

The ability to automatically translate your text content in Smart Localization is one of our most popular features. It quickly provides placeholder text into your game so that you can continue to customize your game to a specific language, without the immediate need of a professional translator.
The Microsoft Translator API also offers 2 million characters per month for free which makes it perfect for our purposes.

This guide will presumes that you have done the following already

Creating a Microsoft Translator Application

With this setup, we need to create a new app in the marketplace in order to be able to use it within Smart Localization. Go to the Azure Marketplace and make sure you are signed in.

At their main page, you should see a button that says "My Account". Click that, and you should be redirected to your account page. When you are there - click the developer button.

This will take you to the developer site of Azure where you can find a button to register a new application. Press the register button.

This should let you create a new application. Fill in correct values of the fields by following the instructions.

Press create and voila! Your microsoft app is created.

Using the Microsoft Translator App in Unity

For this tutorial, I'll use a completely new Smart Localization project. Navigate to the main project window by clicking Window->Smart Localization.

We'll add our newly created application credentials in the section that says "Automatic Translation - Microsoft". Press the Authenticate button when you are done.

Now we are ready to start translating. We'll begin by creating a couple of new keys in the root language file. Press the "Edit Root Language File" window.

Here, I'll just create two keys. One that says "Hello" and one that says "Welcome".

Now, go back to the main Smart Localization Window. It's time to create the languages that we'll automatically translate between. For this, I'll create English and Swedish.

Since our root language file values already are written in english, we can just use these values for our english translation. Press the translate button on the English row to enter the Translate Window.

When you are in this window. Press the "Copy All Values From Root" button and then save. 

Now you can head back to the main Smart Localization window and press the Translate button for Swedish.

You should now see a dropdown with the available languages to translate from if they are compatible with Microsoft Translator. Choose English from the dropdown menu. 

From here, you can either choose to press the "Translate All Text" button - or you can press the "Translate" button next to each individual key. It might take a few seconds before the translation returns from the Microsoft API, but within short the translated keys should appear in the Value column of the translate view. Don't forget to press save.




Smart Localization - The Translate Window

The translate window is where you add the translations to your game. Whether it's text or an asset - it all goes in here.

The translate window enables you to do the following:

  • Translate text values into the desired languages
  • Translate TextAssets, AudioClips, Textures & Prefabs
  • Translate fonts to choose the correct font with the supported glyphs(PRO feature)
  • Automatically translate your text values with Microsoft Translator to another language
  • Search & Sort Translations
  • Override Asset Translations and use the same asset as another language.
  • Copy values from the root language file
  • Watch .csv or .xls file for changes and hot reload (PRO Feature)




Smart Localization - The Edit Root Language Window

The Edit Root Language Window is where you add and change all your keys in your project. It manipulates something called the "root language file".

You could say that the root language file is the law book of all the other translation files. Everything in this file is law, and all other languages and translation need to abide by their rules. It's the very heart of the Smart Localization plugin.

In this window you can:

  • Add new keys
  • Change existing keys
  • Set what specific type each key is. e.g. If you want to localize audio, prefabs, textures or fonts other than just text.
  • Search for a specific key

If you change a key here, all the other language files will be instantly changed as well to reflect the new changes.


Smart Localization - The Main Project Window

The main project window in Smart Localization is the main navigation hub of our plugin. You can find this window by navigating in your Unity Editor to Window -> Smart Localization.

This is where you:

  • Create new languages to translate
  • Export/Update to and from .csv
  • Navigate to the edit root window
  • Navigate to the translate language window
  • Setup your Automatic Translator Account with Microsoft Translator
  • Generate a store presence for App Store & Google Play
  • Create any type of new culture that you want to support. Even made up ones! (PRO feature)
  • Export/Update to and from .xls (PRO feature)
  • Export/Update all languages to and from a single csv/xls file (PRO Feature)

The picture below shows where you can find the different features and areas.