Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by oliver-jones · Jun 02, 2016 at 01:44 PM · textapplication3d textcontentlanguages

Best Practice for Multiple Languages?

Hello,

I'm starting to develop an interactive application that has a lot of content, images and texts (interactive story basically).

I would like to know what the best practice is to support multiple languages within the app (I'm not referring to code - I mean human written words).

The app will be using a lot of 3D Text Meshes, so my first thought would be to attach a script onto all the 3D Text Meshes.

This script will consist of a Text Field for English, German, Spanish, etc ... And whatever the language the user has selected, the scripts will simply swap in and out the requested language within the TextMesh.text.

The only problem with is, is that I may start to lose track of all my 3D Text Meshes throughout the App as there may be loads between different windows, and scenes (Dialog Boxes, Prompts, Buttons, Static Text, etc...).

I would like to know if anyone has a preferable method to overcome this? Thanks.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

6 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Dave-Carlile · Jun 02, 2016 at 01:55 PM

A common method for doing this is to wrap every string in a function call. The function uses the passed in string as a key to look up the translated string based on the current language.

For example:

 field.text = Translate("How are you?");

The function would return How are you? for English, but Hur mår du? for Swedish. Once you deal with all of your strings that way it's a matter of building up your translation dictionaries. There are tools and APIs available - you can probably find something in the app store or even a more general C# library.

Edit: There is a common GNU interface for doing translations. The Unity Wiki has some code that will read the dictionary files for a language and allow using them for translating.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
3

Answer by Bunny83 · Apr 27, 2020 at 10:26 PM

Time has moved on and Unity now provides a localization package. So just check the package manager more often ;)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by chariot · Jun 02, 2016 at 01:55 PM

Why not use some scripts like:

 public class Texts {
 
         public static string Language = "en";
         public const string Russian = "ru";
         public const string English = "en";
         public const string Deutsch = "de";
         public const string Portugal = "pt";
         public const string Turkish = "tr";
 
         public static string STRING_001 { get { 
                 switch (LocalTexts.Language) {
                 case LocalTexts.Russian:
                     return "из";
                 case LocalTexts.English:
                     return "off";
                 case LocalTexts.Deutsch:
                     return "von";
                 case LocalTexts.Portugal:
                     return "de";
                 case LocalTexts.Turkish:
                     return "/";
                 default:
                     return "of";
                 } return ""; } }
 }

Then in any scripts (at start point) do this

 void Awake() {
         switch (Application.systemLanguage) {
         case SystemLanguage.Russian:
             Texts.Language = Texts.Russian;
             break;
         case SystemLanguage.German:
             Texts.Language = Texts.Deutsch;
             break;
         case SystemLanguage.Portuguese:
             Texts.Language = Texts.Portugal;
             break;
         case SystemLanguage.Turkish:
             Texts.Language = Texts.Turkish;
             break;
         default:
             Texts.Language = Texts.English;
             break;
         }
 }

Then in at any script use it like that

 void Awake() {
     Text textField = gameObject.GetComponent<Text>();
     textField.text = LocalTexts.STRING_001;
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by honor0102 · Jun 14, 2019 at 07:32 PM

checkout this thread:

https://forum.unity.com/threads/add-multiple-language-support-to-your-unity-projects.206271/

the used method uses XML file for language translations

also check sGlorz reply for C# class: https://forum.unity.com/threads/add-multiple-language-support-to-your-unity-projects.206271/#post-1909679

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by rogodoy · Apr 27, 2020 at 06:28 PM

I use a script attached to the Ui Text, string will write down every time you use the UiText, if the system is in portuguese, it will use the text in the variable textPort string. The application will validate the system language and write down int the empty string. I found this very easy for me.

 public string  text1Port = "";
 public string text2Eng = "";
 public string text3French = "";


 public Text textTXT;
 


 public void Update()
 {
   
     switch (Application.systemLanguage)
     {
         case SystemLanguage.Portuguese:
             {
                 textTXT.text = text1Port.ToString();
                 Debug.Log(text1Port);
                 break;
             }

         case SystemLanguage.English:
             {
                 textTXT.text = text2Eng.ToString();
                 Debug.Log("This system is in English. ");
                 break;
             }
       

         case SystemLanguage.French:
             {
                 textTXT.text = text3French.ToString();
                 Debug.Log("This system is in French. ");
                 break;
             }
    
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

50 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to script a 3D Text? 1 Answer

Item triggered 3dtext PLZ HELP!!! 1 Answer

Stopping 3D text from showing through game objects in free unity. 1 Answer

How to upload files for use in built game from user's computer? 0 Answers

3D Text not changing font 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges