[RELEASED] Smart Localization for Unity3D

Read this: https://forum.unity3d.com/threads/released-smart-localization-for-unity3d.173837/page-10#post-2982151

Our plugin called Smart Localization & Smart Localization PRO is released on the asset store!

  • Create support of a new language within the click of a button
  • Works with both Unity Pro and Free
  • Supports Automatic Translations with Microsoft Translator
  • Localize assets with an easy to use drag & drop interface
  • Exports language files into .resx .csv & .xls file formats
  • Super Simple to use from code
  • Watch .csv or .xls files for changes and hot reload in the editor (PRO)
  • Support Plural Forms (PRO)
  • Bulk Export/Update all languages into a single .csv / .xls file (PRO)

GitHub Link: GitHub - NiklasBorglund/Smart-Localization-2: A localization plugin for the Unity3D game engine

Tutorials & Samples
Basics

  1. Unity Samples: UI project with Smart Localization implemented

Intermediate

Advanced

Support Email

Smart Localization works with both Unity Pro and Free.
Localizing your game has never been this easy!
Supporting multiple languages in games is becoming increasingly popular, and with Smart Localization you can get full support with just a few mouse clicks!

Smart Localization automatically creates a new folder structure where you can save all your localization data.It saves the language files in the .resx file format. ResX is commonly used for globalization and localization. A wide variety of software is used to translate .resx files.

This plugin also supports Automatic Translations with Microsoft Translator.
All you have to do is to create a Microsoft Translator account and paste in your credentials in the main window and press ā€œSaveā€ and ā€œAuthenticateā€. The translate language window will show a drop down menu of languages to translate from if that specific language is supported. Microsoft Translator gives you 2 million characters to translate each month for free.
Guide to get a Microsoft Translator Account

//Returns a text value in the current language for the key
string myKey = LanguageManager.Instance.GetTextValue("MYKEY");

//Gets the audio clip for the current language
AudioClip myClip = LanguageManager.Instance.GetAudioClip("MYKEY");

//Gets the prefab game object for the current language
GameObject myPrefab = LanguageManager.Instance.GetPrefab("MYKEY");

//Gets the texture for the current language
Texture myTexture = LanguageManager.Instance.GetTexture("MYKEY");

//To cache the LanguageManager in a variable
LanguageManager languageManager = LanguageManager.Instance;

//Get a list of all the available languages
List<SmartCultureInfo> availableLanguages = thisLanguageManager.GetSupportedLanguages();

Get the smart culture info of the system language if it is supported. otherwise it will return null
SmartCultureInfo systemLanguage = thisLanguageManager.GetSupportedSystemLanguage();

//Check if a language is supported with an ISO-639 language code (string = "en" "sv" "es" etc.)
LanguageManager.Instance.IsLanguageSupported("en");

//Check if a language is supported with an instance of SmartCultureInfo
SmartCultureInfo swedishCulture = new SmartCultureInfo("sv", "Swedish", "Svenska", false);
LanguageManager.Instance.IsLanguageSupported(swedishCulture);

//Change a language with an ISO-639 language code ("en" "sv" "es" etc., Make sure the language is supported)
LanguageManager.Instance.ChangeLanguage("en");

//Change the language with a SmartCultureInfo instance
SmartCultureInfo swedishCulture = new SmartCultureInfo("sv", "Swedish", "Svenska", false);
LanguageManager.Instance.ChangeLanguage(swedishCulture);

//How to register on the event that fires when a language changed
LanguageManager.Instance.OnChangeLanguage += OnLanguageChanged; //OnLanguageChanged = delegate method that you created

//Enable extensive debug logging
LanguageManager.Instance.VerboseLogging = true;

//Check if a localized key exists
LanguageManager.Instance.HasKey("myKey")
1 Like

Just generated a better documentation of all the classes with doxygen.

Smart Localization Documentation

Smart Localization 1.1 is submitted to the asset store!

Version 1.1. will add drag drop interface for prefabs, textures and audio clips which will make it extremely easy to localize assets within your game.
It will also copy your assets into an automatic folder structure, keeping track of all your localized assets.
1197384--47698--$Skärmavbild 2013-03-21 kl. 10.30.23.png

Version 1.1 will be available on the Asset Store soon.

Smart Localization 1.1 is released.
NEW FEATURE: Drag Drop Interface for localized Prefabs
NEW FEATURE: Drag Drop Interface for localized Audio Clips
NEW FEATURE: Drag Drop Interface for localized Textures
NEW FEATURE: Complete automatic folder structure for localized assets
NEW FEATURE: Define keys to a type
NEW FEATURE: Delete languages from editor

Web player demo with the new features.

A video tutorial explaining how the new update works.

Great Idea and neat little package.

Question: I have an excel file with all of the languages, does the package have some sort of batch input so that I don’t have to enter every single entry?

Thanks.

Congrats!It’s looking good and attracting!

No, there’s unfortunately no feature like that in the package. What you could do however, is to try and convert your .xls file into a .resx file and compare with how the .resx created in the Smart Localization plugin looks and change accordingly.
They should not be that different(if any), depending on how your excel file looks.

Found a tool that might be worth a look http://www.codeproject.com/Articles/19461/RESX-to-XLS-conversion-for-multi-language-support

Hope that helps!

Thanks! :slight_smile:

Thanks Niklas!

Thanks for creating this great asset and for releasing and supporting it for free!

Best regards,

me :slight_smile:

one little thing

I was running the demo and when I try to translate from English to French using Microsoft Translation Server I’m intermittently getting

any ideas what maybe causing it?

Thanks! I’m glad you like it :slight_smile:

I’m planning on taking some time soon and solve the reported problems. So it can take a few days or so, but I’m on it :slight_smile:

Regarding your issue, does it behave like that even when you try to translate to another language? Or is it just French that’s giving you problems?

Hi and thanks for making this plugin.

However we seem to be having difficulties making this run on Windows phone 8 as the microsoft’s version (.NET 4.0) of the CultureInfo class doesn’t have a method called GetCultureInfo. We tried replacing this with new CultureInfo but seem to be getting some weird errors that don’t look even remotely connected to the CultureInfo class.
Could you please assist us with solving this?

Thanks again.

Do Windows Phone 8 use some kind of subset of .Net 4.0? If so, can you send me a link to the documentation? Because if i’m looking at the .Net 4.0 docs, they do seem to have a function called GetCultureInfo - http://msdn.microsoft.com/en-us/library/yck8b540(v=vs.100).aspx

It is a weird error you are getting though, but read elements and load language should not have anything to do with the culture info class. Does the languages created in the Resources folder look alright?

This is the documentation page for WP8
http://msdn.microsoft.com/en-US/library/windowsphone/develop/system.globalization.cultureinfo(v=vs.105).aspx

You can still use all the functions in the editor, right? It’s only when you build to the phone the errors come?

I’m not in a position to try this on WP8 yet, but you could try and put some special cases (that only turns in effect when you run in wp8 ) in the LanguageManager and only use the List availableLanguages in there. (Like in GetAvailableLanguages() in line 291)

Some pseudocode:

#if !WINDOWS_PHONE_PLATFORM
....Any code that's related to the CultureInfo class.
#endif

Can’t seem to find a define for the windows 8 phone platform, maybe i looked in the wrong places(http://docs.unity3d.com/Documentation/Manual/PlatformDependentCompilation.html)

EDIT: Found it. It’s UNITY_WP8 . (https://docs.unity3d.com/Documentation/Manual/wp8-faq.html)

The Localization System itself is not dependant on the CultureInfo class. What matters is the language strings in the availableLanguages list. That contains the necessary strings like ā€œenā€ ā€œesā€ ā€œfrā€ ā€œsvā€ to load the languages.

Hope that helps. Let me know if it worked. I’ll also look into the issue some more.

Thanks for the package but I’m also getting this error when I try and auto translate:

And then sometimes this one after about a minute of waiting:

Hi,

Sorry for the delay. I’ve fixed some of the bugs on this project now, there’s still some things left to be fixed - but overall things should work a lot better now.

Changes:

  • Sorted the keys in alphabetical order
  • Saved the language file properly with the XMLWriter
  • Several bug fixes
  • Some code refactoring

However, this version is not uploaded to the Asset Store(yet), it needs some testing. I have uploaded the complete project on github until then under the MIT - License, so feel free to use it.

https://github.com/NiklasBorglund/SmartLocalization

To use it in your project, just download the code from github and replace the contents in the SmartLocalization folder with that. Make sure to backup your project before attempting this.

I will try and find the time within the next few days to test it and upload the latest version to the asset store as well.
Any questions, comments or feedback can be sent in this thread or DM me on twitter.

Hi, thank you for this very nice free asset :slight_smile:

I’m developing mini games for Windows Phone 8 and I really need SmartLocalization for my next project.

I’ve attached my workaround to be able to use SmartLocalization in WP8, and gladly this tweak worked well! (at least for GetTextValue).

I hope you can merge my packages with your code so that next version of SmartLocalization in asset store will support Windows Phone 8 out of the box + Playmaker.

Looking forward to see this asset grab its popularity!

1384016–70613–$SmartLocalization_WP8.unitypackage (6.03 KB)
1384016–70614–$SmartLocalization_Playmaker_AddOn.unitypackage (2.43 KB)

That’s great! Thank you!

I just added your WP8 changes to the code and submitted all the latest changes to the asset store.(1.3)

It can take up to a week before it gets accepted though so if you want the latest code right now - you can download it from here: https://github.com/NiklasBorglund/SmartLocalization

Unfortunately I do not own playmaker, so I can’t test your addons for that. Maybe there’s a possibility to create a github fork or something for supporting extensions until we can find a more sustainable solution.

Nice! I think I shall create own repo for SmartLocalization Playmaker Addon

I imported your 1.3 version and I am still getting:

Error building Player: Exception: Error: type System.Globalization.CultureTypes doesn’t exist in target framework.

In the GetSystemLanguage() Method

Modify LanguageManager.cs, line 538, current code still missing platform definition, current code:

CultureInfo[] cultureInfos = CultureInfo.GetCultures(CultureTypes.AllCultures);
foreach(CultureInfo info in cultureInfos)
{
	if(info.EnglishName == systemLanguage)
	{
		return info.Name;	
	}
}

Add platform definition like this:

#if !UNITY_WP8
CultureInfo[] cultureInfos = CultureInfo.GetCultures(CultureTypes.AllCultures);
foreach(CultureInfo info in cultureInfos)
{
	if(info.EnglishName == systemLanguage)
	{
		return info.Name;	
	}
}
#endif