void Start() { var localizationSettings = LocalizationSettings.GetInstanceDontCreateDefault(); // Use included settings if one is available. if (useActiveLocalizationSettings && localizationSettings != null) { Debug.Log("Using included localization data"); return; } Debug.Log("Creating default localization data"); // Create our localization settings. If a LocalizationSettings asset has been created and configured in the editor then we can leave this step out. localizationSettings = LocalizationSettings.CreateDefault(); // Replace the default Locales Provider with something we can manage locally for the example var simpleLocalesProvider = ScriptableObject.CreateInstance <SimpleLocalesProvider>(); localizationSettings.SetAvailableLocales(simpleLocalesProvider); // Add the locales we support simpleLocalesProvider.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.Arabic))); simpleLocalesProvider.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.English))); simpleLocalesProvider.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.French))); simpleLocalesProvider.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.German))); simpleLocalesProvider.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.Japanese))); simpleLocalesProvider.AddLocale(Locale.CreateLocale(CultureInfo.InvariantCulture)); // Set English to be our default localizationSettings.OnSelectedLocaleChanged += OnSelectedLocaleChanged; LocalizationSettings.Instance = localizationSettings; }
public void CreateTestLocalizationSettings() { m_Settings = LocalizationSettings.CreateDefault(); LocalizationSettings.Instance = m_Settings; var simpleLocalesProvider = ScriptableObject.CreateInstance <SimpleLocalesProvider>(); m_Settings.SetAvailableLocales(simpleLocalesProvider); var sl = LocalizationSettings.AvailableLocales; sl.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.Arabic))); sl.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.English))); sl.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.French))); sl.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.German))); sl.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.Japanese))); }
void Start() { // Create our localization settings var localizationSettings = LocalizationSettings.CreateDefault(); // Add the locales we support var supportedLocales = localizationSettings.GetAvailableLocales(); supportedLocales.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.Arabic))); supportedLocales.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.English))); supportedLocales.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.French))); supportedLocales.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.German))); supportedLocales.AddLocale(Locale.CreateLocale(new LocaleIdentifier(SystemLanguage.Japanese))); // Set English to be our default LocalizationSettings.Instance = localizationSettings; }
public static LocalizationSettings CreateLocalizationAsset() { var path = EditorUtility.SaveFilePanelInProject("Save Localization Settings", "Localization Settings", "asset", "Please enter a filename to save the projects localization settings to."); if (string.IsNullOrEmpty(path)) { return(null); } var dependencies = new List <ScriptableObject>(); var ls = LocalizationSettings.CreateDefault(dependencies); AssetDatabase.CreateAsset(ls, path); foreach (var scriptableObject in dependencies) { AssetDatabase.AddObjectToAsset(scriptableObject, ls); } AssetDatabase.SaveAssets(); Selection.activeObject = ls; return(ls); }