I really liked the video I decided to implement this system in my game, but now I can't find how to create a simple dropdow menu that changes the game's language in the game's options menu. how do i do this does anyone know???
Guys. A very important tip that the author of this fantastic video forgot to mention: In order to set a locale manually, you have to write a method with a return type IEnumerator. Then inside of that method, you must write the following c# code: public IEnumerator setLanguage() { // Wait for the localization system to initialize, loading Locales, preloading, etc. yield return LocalizationSettings.InitializationOperation; // This variable selects the language. For example, if in the table your first language is English then 0 = English. If the second language in the table is Russian then 1 = Russian etc. int i = numberOfTheLanguageThatYouWantToUseForUserInterface // This part changes the language LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[i]; } It took me about 6 days to find a working solution to this and I hope that the author will make another video that will demonstrate how to do that through the method that I mentioned above. Also, I hope that my answer will help people to avoid the amount of tortures and headaches that I had while trying to figure this out. Warning: If you are building for Android or IOS and when you launch your app on the device it doesn't translate or throws null exception errors for the Locale then you must do the following: Add addressables in Unity Editor: Window -> Asset Management -> Addressables -> Groups -> Build -> New Build -> Default Build Script -> Build and Run your app. This should do the trick. Extra tip: Efficient translation: Do not use one language translator. Use websites that allow you to translate words into many languages at once. It will save you hours of (select language, copy, paste) cycle. Instead, you will be doing (copy, paste) cycle. Disclaimer: I am not the author of the solutions and I will write the sources of the information at the bottom. I just want to make the life of other developers easier by sharing the information mentioned above. Sources: Localization for phones - null exception errors: forum.unity.com/threads/solved-loading-localization-addressables-fails-in-android.830412/ Setting locale with LocalizationSettings.SelectedLocale = locale: forum.unity.com/threads/how-to-update-localizestring-at-runtime.969270/
Oh here's a script for a dropdown permitting the change of locale: using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.Localization.Settings; public class LocaleDropdown : MonoBehaviour { public TMP_Dropdown dropdown; IEnumerator Start() { // Wait for the localization system to initialize, loading Locales, preloading etc. yield return LocalizationSettings.InitializationOperation; // Generate list of available Locales var options = new List(); int selected = 0; for (int i = 0; i < LocalizationSettings.AvailableLocales.Locales.Count; ++i) { var locale = LocalizationSettings.AvailableLocales.Locales[i]; if (LocalizationSettings.SelectedLocale == locale) selected = i; options.Add(new TMP_Dropdown.OptionData(locale.name)); } dropdown.options = options; dropdown.value = selected; dropdown.onValueChanged.AddListener(LocaleSelected); } static void LocaleSelected(int index) { LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[index]; } }
For selecting different locales with a button you can also add localizationsettings to an onclick event and then SetSelectedLocale and offcoarse your desired locale.
This is very cool to see. I always thought I'd have to build my own localization system, and I was just about to start a system where I can grab strings from external files. So glad there is an official system, and what's more, that it is really easy to implement into all my different system. Whether the text is coming from a UI button, a dialogue tree, or some custom script, I should be able to easily add this on top of what I'm doing.
Latest version; You don't have to create C# to add some public variable, You have now "Local Variables". Just make sure you spell Variable Name same as in {playerName} and use String (for this example) And thanks for this guide =)
I did exactly same nut when I reached at 7:36, I started getting these Errors :- 1). Exception encountered in operation Resource(settings_BuildScriptFastMode.json): Unknown error in AsyncOperation UnityEngine.Localization.Components.LocalizeStringEvent:OnEnable () 2). No Locales were available. Did you build the Addressables? 3). Can not preload when `LocalizationSettings.SelectedLocale` is null. UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange) 4). Can not preload when `LocalizationSettings.SelectedLocale` is null. UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange) Please help.
"Command Line Locale Selector" seems to be an option you can specify when running the application from the CLI, like "./myGame --language=jp" or "./myGame --lang=de". The option lets you specify what option Unity looks for when starting.
Do you have an updated video? I can't seem to find the new one you said you'd make. I don't really know how to access the localization data from a script directly. I'm assuming i have to use this key I made? So, how do I, through script, set a text object to a string of a specific key from the table? And how do I select the language in game?
hi mr dinosor, just found your channel via @jasonweimann shoutout. im so happy and gonna start binge watching the basics ones and wish you dont stop your unity c# bitesize series!
THIS IS FROM *@ZoidbergForPresident* not me :P using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.Localization.Settings; public class LocaleDropdown : MonoBehaviour { public TMP_Dropdown dropdown; IEnumerator Start() { // Wait for the localization system to initialize, loading Locales, preloading etc. yield return LocalizationSettings.InitializationOperation; // Generate list of available Locales var options = new List(); int selected = 0; for (int i = 0; i < LocalizationSettings.AvailableLocales.Locales.Count; ++i) { var locale = LocalizationSettings.AvailableLocales.Locales[i]; if (LocalizationSettings.SelectedLocale == locale) selected = i; options.Add(new TMP_Dropdown.OptionData(locale.name)); } dropdown.options = options; dropdown.value = selected; dropdown.onValueChanged.AddListener(LocaleSelected); } static void LocaleSelected(int index) { LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[index]; } }
Hello! Thanks for the video, it has been very useful. I was wondering if you already uploaded the follow-up where you said you will show how to change the strings via script, thanks!
I assume the "command line locale selector" might mean that you can run your game through a command prompt and use that argument as a way to select the language you want, instead of having to make an actual menu or something (I don't know why you'd want that, but you've got it)
But what if the characters are different? For example you cannot use english alphabets for chinese, Hindi, Arabic and russian languages. They have totally different alphabets/characters/letters whatever it's called. So how to deal with that?
could you help me to show the player name? In the inspector i have the field "Local Variables", i added string event with the variable name "playerName", i can show the name in the string field, but i cant change the name string by script, could u tell me how to acess that field in script?
Hello! Very helpful video. Just one question: is there a way to change language for script-generated strings? Something like that: switch(language){ case english: text = hello case spanish: text = hola case french: text = bonjour }
Hello, since this update i always get this error "InvalidProgramException: Invalid IL code in Script.Funcion (string): IL_000f: call 0x0a00000d" and i cant figure a solution, any idea??
Thanks! I encountered an issue. When I press play the text comes with a 1-2 second delay. I thought it's about the script execution order, but I couldn't fixed it.
I'm a little late but wouldn't it make sense that you can't just do [SerializeField] private variables? Because you'd be trying to reference a private variable in another script.
Thank you.. but it doesn't run dinamically.. Do you know how can we change entry name dinamically? If I have a message box and want to show convenient message for some conditions. I can create Alert Message Table and prepare message box object. Therefore I have to change entry name dinamically.
In editor text field is empty and only show on run mode. Is there a way to show default english in editor mode also. Hard to edit text in editor this way
This video shows how to set this up right at the beginning of a project. But what if you decide to add new languages for a finished game and send the project to people who speak those other languages? Could their approach of translating the game be the same like instructed in the video, or will it be different to work on a finished project?
Hello, I installed the Localization package on Unity 2019.4.10f1, I followed the Dino steps, and when i tried to Crete a Localisation Settings, an arror accures in console, Element 'Style' has no registered factory method. UnityEditor.InspectorWindow:RedrawFromNative(). is there any solution for that? Thank you!
Thanks for this great tutorial. I'm quite new to game developing, just working on my first, very simple, game, and i just realized i want multiple languages. I'm so glad there's this quite simple method to do it, even in retrospect. One little question though, after implementing the localisation package there's this new folder "AdressableAssetsData". I guess i should just leave it there because it somehow manages this package? Edit: Two more problems, i get some "SelectedLocale is null" exceptions. Also it seems to not save the standard language. When i start my game the dropdown menu says "None". I can then select another language and back and it works, but still the initial language is somehow "None".
Solved it. If you have the same problem go to "Window -> Asset Management -> Localization Scene Controls" and set "Active Locale" to your preferred language to start the game with. All errors are gone now 😅
In the "Localization" menu there is a section called "Locale Selectors", which is a list. Unity goes from top to bottom until it found a locale. The second thing there by default is the "System Locale Selector", which should do what you asked for.
I really liked the video I decided to implement this system in my game, but now I can't find how to create a simple dropdow menu that changes the game's language in the game's options menu. how do i do this does anyone know???
hello. I do not understand how the language is switched on a real device. Have you tried experimenting with this program on a real device with different language settings? It didn't work for me the first time...
@@noa9956 Yes. I have fixed this problem. If the language is not automatically switched, then you need to check the following: - Does your project contain any locales? - Did you configure the Locale Selectors so they pick one? docs.unity3d.com/Packages/com.unity.localization@0.6/manual/LocalizationSettings.html - Did you build the addressable assets when building to Android? My problem was that I forget to build the Addresseables to work in android. To fix this problem, you need to do the following: Window -> Asset Manager ->Addresseables -> Groups -> Build -> New build When my program starts I preload the locales with: LocalizationSettings.InitializationOperation; My program is working! If you open the apk as an archive file, then after the above operation, I have a folder "aa" (*. apk\assets\aa) which contains localization files, before comparison, this folder did not appear before. here I wrote what was described in this forum thread: forum.unity.com/threads/android-and-localizationsettings-selectedlocale.817590/
Just in case someone cant find Localization in package manager, to save you 5-10 minutes of searching click the plus to add a new package, click add package from GIT URL, paste this there, no quotation marks "com.unity.localization"
Good stuff,but im trying to change the language on my android phone and the game is not changing from the default language,what am i doing wrong? Do i need to check system's language by code or something?
Hi. It works on the emulator but when I execute the app in my phone it doesn't select any language. Is it necessary to do some special configuration to generate the APK? (I am working with 1.0.0 version)
3 года назад
Hey great video, i have a question tho, if i already got a little "subtitles" system for a game, which works with ScriptableObjects files to get the different strings with their timestamps to be shown at the screen, how can i implement this new localization thing to a little system like that D: ?
A quick question concerning 'smart', I have list of strings for names in my code, and a couple of text fields in the project that could have any one of those. How could I approach localizing in this case ?..
I think the player name is supposed to be public because other classes cannot get the values of variables from other classes without them being public. Idk though.
Unity just surprises me more and more with each released feature (even in preview). I've always been afraid to dive into localization stuff, cuz it seemed boring and tedious. And now it's not much different from anything else in the engine. BTW You can not get access to "[SerializeField] private" variables the way you want. They are exposed in the inspector - so you can set them, but since they are private, you can't get their data outside the script they're in. Making variables public is probably the only way to do what you want, unless you store your player data in ScriptableObjects, which is way easier and better probably.
I was afraid of the whole localization thing for a while too, wayy before I started making games. One day I was determined to translate this skyrim mod that was only on japaneese language (you can guess what kind of mod it was just from that fact haha), so I sat for four hours translating everything, it was a mess, but I succeeded. It was a huge mod too lol. I plan on storing a static public variable that will represent the language, and will be alive in every scene. Later I plan adding some sort of session, or a cookie to store the value and read it from there.
I added language switching from the menu to my game. When I run it in Unity, everything goes normal, but the language does not change on the android phone.
@@nagybalint1474 what I want to say is that when I test it on the unity editor on the computer, I can change the language, but when I build and test it on the phone, it doesn't work.
@@nagybalint1474 Private/serialized fields have no affect on memory or performance. The fields take up the same amount of memory regardless. The main reason to use private fields over public fields is to follow object-oriented programming encapsulation conventions.
@@nagybalint1474 Quick question, do you get exceptions? I did it like in the video and basically it works fine in the editor when i switch around, but at startup i always get some exceptions that say "SelectedLocale is null". Edit: solved it. In "Window -> Asset Management -> Localization Scene Controls" i had to set "Active Locale" and now it works fine 😅
Currently on latest 2021.2.16 you can find the package from the package manager docs.unity3d.com/Packages/com.unity.localization@1.2/manual/Installation.html
Check out Admix here: admixplay.com/
I really liked the video I decided to implement this system in my game, but now I can't find how to create a simple dropdow menu that changes the game's language in the game's options menu. how do i do this does anyone know???
Guys. A very important tip that the author of this fantastic video forgot to mention:
In order to set a locale manually, you have to write a method with a return type IEnumerator.
Then inside of that method, you must write the following c# code:
public IEnumerator setLanguage() {
// Wait for the localization system to initialize, loading Locales, preloading, etc.
yield return LocalizationSettings.InitializationOperation;
// This variable selects the language. For example, if in the table your first language is English then 0 = English. If the second language in the table is Russian then 1 = Russian etc.
int i = numberOfTheLanguageThatYouWantToUseForUserInterface
// This part changes the language
LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[i];
}
It took me about 6 days to find a working solution to this and I hope that the author will make another video that will demonstrate how to do that through the method that I mentioned above.
Also, I hope that my answer will help people to avoid the amount of tortures and headaches that I had while trying to figure this out.
Warning:
If you are building for Android or IOS and when you launch your app on the device it doesn't translate or throws null exception errors for the Locale then you must do the following:
Add addressables in Unity Editor:
Window -> Asset Management -> Addressables -> Groups -> Build -> New Build -> Default Build Script -> Build and Run your app. This should do the trick.
Extra tip:
Efficient translation:
Do not use one language translator. Use websites that allow you to translate words into many languages at once. It will save you hours of (select language, copy, paste) cycle. Instead, you will be doing (copy, paste) cycle.
Disclaimer:
I am not the author of the solutions and I will write the sources of the information at the bottom. I just want to make the life of other developers easier by sharing the information mentioned above.
Sources:
Localization for phones - null exception errors:
forum.unity.com/threads/solved-loading-localization-addressables-fails-in-android.830412/
Setting locale with LocalizationSettings.SelectedLocale = locale:
forum.unity.com/threads/how-to-update-localizestring-at-runtime.969270/
So there's no way to make localized strings update without switching to a different locale?
I wouldn't mind another video for that! Or even to get the default language of the system for the first start.
Oh here's a script for a dropdown permitting the change of locale:
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Localization.Settings;
public class LocaleDropdown : MonoBehaviour
{
public TMP_Dropdown dropdown;
IEnumerator Start()
{
// Wait for the localization system to initialize, loading Locales, preloading etc.
yield return LocalizationSettings.InitializationOperation;
// Generate list of available Locales
var options = new List();
int selected = 0;
for (int i = 0; i < LocalizationSettings.AvailableLocales.Locales.Count; ++i)
{
var locale = LocalizationSettings.AvailableLocales.Locales[i];
if (LocalizationSettings.SelectedLocale == locale)
selected = i;
options.Add(new TMP_Dropdown.OptionData(locale.name));
}
dropdown.options = options;
dropdown.value = selected;
dropdown.onValueChanged.AddListener(LocaleSelected);
}
static void LocaleSelected(int index)
{
LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[index];
}
}
One more extra tip:
Always localize to Portuguese (Brazil). Thank you. ^^
For selecting different locales with a button you can also add localizationsettings to an onclick event and then SetSelectedLocale and offcoarse your desired locale.
Thank you Dapper Dino. You've saved me hours of time with this video. I was busy writing my own localization system when I stumbled on this
Short and good, keep it up!
Thanks, will do!
Very cool that unity added support for this! Thanks for explaining it :)
No problem!
This is very cool to see.
I always thought I'd have to build my own localization system, and I was just about to start a system where I can grab strings from external files.
So glad there is an official system, and what's more, that it is really easy to implement into all my different system. Whether the text is coming from a UI button, a dialogue tree, or some custom script, I should be able to easily add this on top of what I'm doing.
Latest version;
You don't have to create C# to add some public variable,
You have now "Local Variables".
Just make sure you spell Variable Name same as in {playerName}
and use String (for this example)
And thanks for this guide =)
I did exactly same nut when I reached at 7:36, I started getting these Errors :-
1). Exception encountered in operation Resource(settings_BuildScriptFastMode.json): Unknown error in AsyncOperation
UnityEngine.Localization.Components.LocalizeStringEvent:OnEnable ()
2). No Locales were available. Did you build the Addressables?
3). Can not preload when `LocalizationSettings.SelectedLocale` is null.
UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange)
4). Can not preload when `LocalizationSettings.SelectedLocale` is null.
UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange)
Please help.
"Command Line Locale Selector" seems to be an option you can specify when running the application from the CLI, like "./myGame --language=jp" or "./myGame --lang=de". The option lets you specify what option Unity looks for when starting.
If you can find "string reference" go to preferences/localization and uncheck the string one.
Life saver! Thx
I really liked the video. Thanks!! I wanted to add localisation to my future game and this looks perfect.
Glad it helped!
Such a nice little feature. Glad I checked before starting my next project
Can you please help me? How do I change the text in a string variable on a scriptable object with this system?
How we can
Hello,
Is it also possible to change the language in an array? I would like to use it in a dialogue system. Thanks in advance for your response
Do you have an updated video? I can't seem to find the new one you said you'd make. I don't really know how to access the localization data from a script directly. I'm assuming i have to use this key I made? So, how do I, through script, set a text object to a string of a specific key from the table? And how do I select the language in game?
hi mr dinosor, just found your channel via @jasonweimann shoutout. im so happy and gonna start binge watching the basics ones and wish you dont stop your unity c# bitesize series!
Gotta do this for every text component ? Is there any way to use a centralized file and use key_id like "strings.xml" in android ?
Does someone knows how to change the key of the table in real time? I don't know how to modify the "Localize string event"
Really cool, well explained
Glad you liked it!
how to change the current language manually using script by pressing button?
How to use it for localizing dropdown options?
THIS IS FROM *@ZoidbergForPresident*
not me :P
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Localization.Settings;
public class LocaleDropdown : MonoBehaviour
{
public TMP_Dropdown dropdown;
IEnumerator Start()
{
// Wait for the localization system to initialize, loading Locales, preloading etc.
yield return LocalizationSettings.InitializationOperation;
// Generate list of available Locales
var options = new List();
int selected = 0;
for (int i = 0; i < LocalizationSettings.AvailableLocales.Locales.Count; ++i)
{
var locale = LocalizationSettings.AvailableLocales.Locales[i];
if (LocalizationSettings.SelectedLocale == locale)
selected = i;
options.Add(new TMP_Dropdown.OptionData(locale.name));
}
dropdown.options = options;
dropdown.value = selected;
dropdown.onValueChanged.AddListener(LocaleSelected);
}
static void LocaleSelected(int index)
{
LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[index];
}
}
Up ❤
Hello! Thanks for the video, it has been very useful. I was wondering if you already uploaded the follow-up where you said you will show how to change the strings via script, thanks!
I'm looking for that too!
Really helpful viedo thanks dude!
I assume the "command line locale selector" might mean that you can run your game through a command prompt and use that argument as a way to select the language you want, instead of having to make an actual menu or something (I don't know why you'd want that, but you've got it)
Yup, think so too. I'd still probably just leave it on English as default then add a menu on first startup for language (as well as in setup)
Thx very helpfully. Btw nice voice
But what if the characters are different? For example you cannot use english alphabets for chinese, Hindi, Arabic and russian languages. They have totally different alphabets/characters/letters whatever it's called. So how to deal with that?
could you help me to show the player name?
In the inspector i have the field "Local Variables", i added string event with the variable name "playerName", i can show the name in the string field, but i cant change the name string by script, could u tell me how to acess that field in script?
Hello! Very helpful video. Just one question: is there a way to change language for script-generated strings? Something like that:
switch(language){
case english:
text = hello
case spanish:
text = hola
case french:
text = bonjour
}
I'm guessing you can assign the the string to a public variable and use the smart text thing?
I want to change the font asset depending on the language , but I coudn't figure out how to get the current selected language form script
Nice video, very helpful !!
anybody knows how to localization connection google Sheets??
Hello, since this update i always get this error "InvalidProgramException: Invalid IL code in Script.Funcion (string): IL_000f: call 0x0a00000d" and i cant figure a solution, any idea??
Please make another video, related to other types of asset usage, and through script language change settings topics get covered.
Thanks! I encountered an issue. When I press play the text comes with a 1-2 second delay. I thought it's about the script execution order, but I couldn't fixed it.
Excellent video. Thanks!
how can i implement this with a dialogue system?
If you have a table with a list of words, how would you make a textMesh text change to a random item of the table every 30 seconds ?
Hello sir, please make video related to Smart Localized String related video because this video content become outdated now.
Guys any tutorials on buttons that change the language in menu? Just like the one you have in runtime near the gizmos? Thanks
I'm a little late but wouldn't it make sense that you can't just do [SerializeField] private variables? Because you'd be trying to reference a private variable in another script.
Nah you always late
This is so helpful! Thanks
Thank you.. but it doesn't run dinamically.. Do you know how can we change entry name dinamically? If I have a message box and want to show convenient message for some conditions. I can create Alert Message Table and prepare message box object. Therefore I have to change entry name dinamically.
In editor text field is empty and only show on run mode. Is there a way to show default english in editor mode also. Hard to edit text in editor this way
This video shows how to set this up right at the beginning of a project. But what if you decide to add new languages for a finished game and send the project to people who speak those other languages? Could their approach of translating the game be the same like instructed in the video, or will it be different to work on a finished project?
i am tired of changing each text one by one of my game. Is there any way of accessing table keys and values in script.
So how to use it with an array?
Which version it was?
'Cause the things are much more complicated than this now 🤔
Hello, I installed the Localization package on Unity 2019.4.10f1, I followed the Dino steps, and when i tried to Crete a Localisation Settings, an arror accures in console, Element 'Style' has no registered factory method. UnityEditor.InspectorWindow:RedrawFromNative(). is there any solution for that? Thank you!
Thanks for this great tutorial.
I'm quite new to game developing, just working on my first, very simple, game, and i just realized i want multiple languages. I'm so glad there's this quite simple method to do it, even in retrospect.
One little question though, after implementing the localisation package there's this new folder "AdressableAssetsData". I guess i should just leave it there because it somehow manages this package?
Edit: Two more problems, i get some "SelectedLocale is null" exceptions. Also it seems to not save the standard language. When i start my game the dropdown menu says "None". I can then select another language and back and it works, but still the initial language is somehow "None".
Solved it.
If you have the same problem go to "Window -> Asset Management -> Localization Scene Controls" and set "Active Locale" to your preferred language to start the game with.
All errors are gone now 😅
This sets the system language as game language by default?
Not by default as far as I'm aware. But I'm sure you can do that somehow with the command line stuff at 3:38
In the "Localization" menu there is a section called "Locale Selectors", which is a list. Unity goes from top to bottom until it found a locale. The second thing there by default is the "System Locale Selector", which should do what you asked for.
lmao for me its the opposite it uses that by default and I want English by default, any idea how
I really liked the video I decided to implement this system in my game, but now I can't find how to create a simple dropdow menu that changes the game's language in the game's options menu. how do i do this does anyone know???
ruclips.net/video/4lnpryCQTmI/видео.html&ab_channel=TheRealProfessionalGamer
Thanks! A great tutorial
What about diacritics? Some letters are showing up as □ and I'm 100% sure that the font has these symbols in it.
That is soo niceee!
hello. I do not understand how the language is switched on a real device. Have you tried experimenting with this program on a real device with different language settings? It didn't work for me the first time...
have you figured out? i'm having the same problem
@@noa9956 Yes. I have fixed this problem. If the language is not automatically switched, then you need to check the following:
- Does your project contain any locales?
- Did you configure the Locale Selectors so they pick one? docs.unity3d.com/Packages/com.unity.localization@0.6/manual/LocalizationSettings.html
- Did you build the addressable assets when building to Android?
My problem was that I forget to build the Addresseables to work in android. To fix this problem, you need to do the following:
Window -> Asset Manager ->Addresseables -> Groups -> Build -> New build
When my program starts I preload the locales with: LocalizationSettings.InitializationOperation;
My program is working!
If you open the apk as an archive file, then after the above operation, I have a folder "aa" (*. apk\assets\aa) which contains localization files, before comparison, this folder did not appear before.
here I wrote what was described in this forum thread: forum.unity.com/threads/android-and-localizationsettings-selectedlocale.817590/
@@ОлегМашков-я8х Thank you my man!!
Is there a way to automatically translate to other languages?
There is no way i can translate my script generated string?
Really helpfull Video Thnks!!!
Just in case someone cant find Localization in package manager, to save you 5-10 minutes of searching
click the plus to add a new package, click add package from GIT URL, paste this there, no quotation marks "com.unity.localization"
Good stuff,but im trying to change the language on my android phone and the game is not changing from the default language,what am i doing wrong? Do i need to check system's language by code or something?
Hi. It works on the emulator but when I execute the app in my phone it doesn't select any language. Is it necessary to do some special configuration to generate the APK? (I am working with 1.0.0 version)
Hey great video, i have a question tho, if i already got a little "subtitles" system for a game, which works with ScriptableObjects files to get the different strings with their timestamps to be shown at the screen, how can i implement this new localization thing to a little system like that D: ?
A quick question concerning 'smart', I have list of strings for names in my code, and a couple of text fields in the project that could have any one of those. How could I approach localizing in this case ?..
save the strings in a another script on the UI or on some canvas and use the string from there
YOU ARE A WIZARD DUDE!
I think the player name is supposed to be public because other classes cannot get the values of variables from other classes without them being public. Idk though.
How do we integrate mobile?
Unity just surprises me more and more with each released feature (even in preview). I've always been afraid to dive into localization stuff, cuz it seemed boring and tedious. And now it's not much different from anything else in the engine.
BTW
You can not get access to "[SerializeField] private" variables the way you want.
They are exposed in the inspector - so you can set them, but since they are private, you can't get their data outside the script they're in.
Making variables public is probably the only way to do what you want, unless you store your player data in ScriptableObjects, which is way easier and better probably.
I was afraid of the whole localization thing for a while too, wayy before I started making games. One day I was determined to translate this skyrim mod that was only on japaneese language (you can guess what kind of mod it was just from that fact haha), so I sat for four hours translating everything, it was a mess, but I succeeded. It was a huge mod too lol.
I plan on storing a static public variable that will represent the language, and will be alive in every scene. Later I plan adding some sort of session, or a cookie to store the value and read it from there.
I added language switching from the menu to my game. When I run it in Unity, everything goes normal, but the language does not change on the android phone.
? makes 0 sense you run it on pc and why would it change on the phone export it to android and it will work fine
@@nagybalint1474 what I want to say is that when I test it on the unity editor on the computer, I can change the language, but when I build and test it on the phone, it doesn't work.
format argument no longer exists it seems, too bad.
What about arabic?
Thank you
public makes so much more sense than serialized private, if you think about it, tho.
nop we always want to use serialized privates to save memory and stabilize gameplay etc
@@nagybalint1474 Private/serialized fields have no affect on memory or performance. The fields take up the same amount of memory regardless.
The main reason to use private fields over public fields is to follow object-oriented programming encapsulation conventions.
thank you for your explanation put i did expect how to write inside unity in Arabic language not translation
Thas dope!
i think when i see arabic it's finally unity support right To left languages but when i try it . i feel disappoint
Knowing that all other engines support right to left
languages
It sucks that you can't use it with the new UI toolkit
i use this with the newest every stable until version and it works fine
@@nagybalint1474
Quick question, do you get exceptions?
I did it like in the video and basically it works fine in the editor when i switch around, but at startup i always get some exceptions that say "SelectedLocale is null".
Edit: solved it.
In "Window -> Asset Management -> Localization Scene Controls" i had to set "Active Locale" and now it works fine 😅
Ohh, I wrote my own system.
Oh man, I thought Arabic would be fixed but no..
Overcomplicated method
Currently on latest 2021.2.16 you can find the package from the package manager
docs.unity3d.com/Packages/com.unity.localization@1.2/manual/Installation.html