public static void changeStaticInstanceConfigBasedOnTranslationConfigurationGroup(string group = "") { var config = ResourceLoadFacade.LoadConfigGroup(group); if (config == null) { Debug.LogWarning("No default translation configuration found"); } changeStaticInstanceConfig(config.sourceLanguage.code, group); }
public static void setKeyInDefaultLanguageDB(string key, string value, string groupid = "") { //Debug.LogWarning("Make sure to set language to game source language before saving a new translation key"); Dictionary <string, string> translationDictionary = TranslationUtility.getUtilityInstanceForDebugging().allKnownTranslations; TranslationConfigurationSO config = ResourceLoadFacade.LoadConfigGroup(groupid); GameTranslationSet gameTranslationSet = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(config.sourceLanguage.code); bool exists = translationDictionary.ContainsKey(key); if (!exists) { translationDictionary.Add(key, key); } translationDictionary[key] = value; //find a way to make sure the the SO gets set dirty? gameTranslationSet.mergeInSet(groupid, translationDictionary); //EditorUtility.SetnDirty(TransfluentUtility.getUtilityInstanceForDebugging()); }
//public static event Action OnLanguageChanged; public static ITranslationUtilityInstance createNewInstance(string destinationLanguageCode = "", string group = "") { if (_LanguageList == null) { _LanguageList = ResourceLoadFacade.getLanguageList(); } if (_LanguageList == null) { Debug.LogError("Could not load new language list"); return(null); } bool enableCapture = false; #if UNITY_EDITOR if (Application.isEditor) { enableCapture = getCaptureMode(); } #endif //UNTIY_EDITOR TransfluentLanguage dest = _LanguageList.getLangaugeByCode(destinationLanguageCode); if (dest == null) { TranslationConfigurationSO defaultConfigInfo = ResourceLoadFacade.LoadConfigGroup(group); string newDestinationLanguageCode = defaultConfigInfo.sourceLanguage.code; /* * if (string.IsNullOrEmpty(destinationLanguageCode)) * { * Debug.Log("Using default destination language code, as was given an empty language code"); * } * else * Debug.Log("Could not load destination language code:" + destinationLanguageCode + " so falling back to source game language code:" + destinationLanguageCode); */ destinationLanguageCode = newDestinationLanguageCode; dest = _LanguageList.getLangaugeByCode(destinationLanguageCode); //dest = _LanguageList.getLangaugeByCode } GameTranslationSet destLangDB = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(destinationLanguageCode); Dictionary <string, string> keysInLanguageForGroupSpecified = destLangDB != null ? destLangDB.getGroup(group).getDictionaryCopy() : new Dictionary <string, string>(); #if UNITY_EDITOR EditorUtility.SetDirty(destLangDB); #endif var newTranslfuentUtilityInstance = new TranslationUtilityInstance { allKnownTranslations = keysInLanguageForGroupSpecified, destinationLanguage = dest, groupBeingShown = group, }; if (enableCapture) { newTranslfuentUtilityInstance = new AutoCaptureTranslationUtiliityInstance() { allKnownTranslations = keysInLanguageForGroupSpecified, destinationLanguage = dest, groupBeingShown = group, doCapture = enableCapture, coreTransltionSet = destLangDB, }; } return(newTranslfuentUtilityInstance); }