Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Localization (Multi-Language) - Make your app international

Discussion in 'Assets and Asset Store' started by GleyGames, Feb 14, 2020.

  1. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    415
    Localization (Multi-Language)
    Make your app international
    Localization_1200x630.png
    Get it from Asset Store - Localization (Multi-Language)
    For detailed implementation instructions see the Documentation


    Key Features:

    • Make your app international by translating it into multiple languages fast and easy.
    • Supports all languages supported by Unity. Complete list available here
    • All settings are done inside a custom Settings Window.
    • Automatically detects the device language and if no translation is available in that language the default language will be used.
    • Saves and Loads the last language used.
    • Auto Translation implemented inside Settings Window. Automatically translations can be done by a single click inside asset.
    • Import/Export translations to .CSV files.
    • Works with Unity UI, Text Mesh Pro and nGUI.
    • Translations can be done automatically by adding a component to your text or by calling a single line of code.
    • Full example scenes included
    • All code is available and fully commented
    • Works with Unity 2017.1 and above with Free, Plus or Pro license.
    • Works on all supported Unity platforms.
    Easy setup from a Settings Window:
    SettingwWindow.jpg

    Code example:
    Code (CSharp):
    1. public class SetLanguageExample : MonoBehaviour
    2. {
    3.  
    4.     public Text languageText;
    5.     public Text nextText;
    6.     public Text prevText;
    7.     public Text playText;
    8.     public Text exitText;
    9.     public Text saveText;
    10.     void Start()
    11.     {
    12.         RefreshTexts();
    13.     }
    14.  
    15.  
    16.     /// <summary>
    17.     /// Set localized text for each text field
    18.     /// </summary>
    19.     void RefreshTexts()
    20.     {
    21.         languageText.text = GleyLocalization.Manager.GetCurrentLanguage().ToString();
    22.         nextText.text = GleyLocalization.Manager.GetText("NextID");//this has the same result as using the enum like bellow
    23.         //nextText.text = GleyLocalization.Manager.GetText(WordIDs.NextID);
    24.         prevText.text = GleyLocalization.Manager.GetText("PrevID");
    25.         //prevText.text = GleyLocalization.Manager.GetText(WordIDs.PrevID);
    26.         playText.text = GleyLocalization.Manager.GetText("PlayID");
    27.         //playText.text = GleyLocalization.Manager.GetText(WordIDs.PlayID);
    28.         exitText.text = GleyLocalization.Manager.GetText("ExitID");
    29.         //exitText.text = GleyLocalization.Manager.GetText(WordIDs.ExitID);
    30.         saveText.text = GleyLocalization.Manager.GetText("SaveID");
    31.         //saveText.text = GleyLocalization.Manager.GetText(WordIDs.SaveID);
    32.     }
    33.  
    34.  
    35.     /// <summary>
    36.     /// Assigned from editor. Changes current language to next language
    37.     /// </summary>
    38.     public void NextLanguage()
    39.     {
    40.         GleyLocalization.Manager.NextLanguage();
    41.         RefreshTexts();
    42.     }
    43.  
    44.  
    45.     /// <summary>
    46.     /// Assigned from editor. Changes current language to previous language
    47.     /// </summary>
    48.     public void PrevLanguage()
    49.     {
    50.         GleyLocalization.Manager.PreviousLanguage();
    51.         RefreshTexts();
    52.     }
    53.  
    54.  
    55.     /// <summary>
    56.     /// Save the current selected language
    57.     /// </summary>
    58.     public void SaveLanguage()
    59.     {
    60.         GleyLocalization.Manager.SetCurrentLanguage(GleyLocalization.Manager.GetCurrentLanguage());
    61.     }
    62. }
    For more help watch our tutorial videos:

     
  2. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    415
  3. jonhgaarg

    jonhgaarg

    Joined:
    Jul 28, 2019
    Posts:
    7
    Thanks for guide. I have a news app that I would like to localize too. Tell me, at the expense of language translations, did you do this yourself? I found TheWordPoint translation service https://thewordpoint.com/services/localization/application , which provides similar services. Perhaps you tell me other methods? Thanks.
     
    Last edited: Jul 10, 2020
    GleyGames likes this.
  4. pudd1nG

    pudd1nG

    Joined:
    Feb 21, 2012
    Posts:
    36
    Hello,

    After translating maybe 15 phrases, i now get a nullreference exception when pressing translate. It seems like its trying to access an empty List / Array.

    Is there some kind of rate limit on the service used to translate in editor?
     
  5. pudd1nG

    pudd1nG

    Joined:
    Feb 21, 2012
    Posts:
    36
    Sorry to double post - but switching platforms (for example below is switching from android to ios) within unity breaks the localisation.

    upload_2020-9-10_11-30-57.png

    Makes it impossible to edit the localisation assigned to existing objects.

    When switching from ios to android (the opposite from above) - all localisations are set to use the same string. Destroying hours of work in complex scenes :(
     
  6. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    415
    Hello,
    there is not a limit of translations it should work with any number of words. It will help us if you could describe in more details what your error was to be able to replicate it and fix it if it is a bug.
    About the second Issue. It looks like you have compile issues when you switch your platform. Please fix all errors as it says in your warning and the components will be available again.
     
  7. pmilholl

    pmilholl

    Joined:
    Sep 10, 2020
    Posts:
    3
    I get the same error. After translating about 15 words, I get null exceptions too whenever I hit translate:

    NullReferenceException: Object reference not set to an instance of an object
    GleyLocalization.JSONNode.Parse (System.String aJSON) (at Assets/GleyPlugins/Localization/Scripts/SimpleJSON.cs:555)
    GleyLocalization.GoogleTranslation.MyUpdate () (at Assets/GleyPlugins/Localization/Scripts/Editor/GoogleTranslation.cs:41)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <3b1af5075b0340cfb428dfcef292b2ea>:0)
     
  8. pmilholl

    pmilholl

    Joined:
    Sep 10, 2020
    Posts:
    3
    I waited a few hours and now it works again. I am with the earlier poster, it is probably a rate limiter.
     
  9. GleyGames

    GleyGames

    Joined:
    Oct 16, 2015
    Posts:
    415
    Hello,
    It looks like google servers have some limitation, Also try updating our plugin to the latest version and see if you are getting the same error.
     
unityunity