public static TranslationConfigurationSO getOrCreateGameTranslationConfig(string groupid) { string fileName = ResourceLoadFacade.TranslationConfigurationSOFileNameFromGroupID(groupid); TranslationConfigurationSO config = ResourceLoadFacade.LoadConfigGroup(groupid) ?? ResourceCreator.CreateSO <TranslationConfigurationSO>(fileName); config.translation_set_group = groupid; return(config); }
private static void saveSet(TransfluentLanguage language, Dictionary <string, string> pairs, string groupid = null) { try { string languageCode = language.code; GameTranslationSet set = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(languageCode) ?? ResourceCreator.CreateSO <GameTranslationSet>( GameTranslationGetter.fileNameFromLanguageCode(languageCode)); if (set.language == null) { set.language = language; } set.mergeInSet(groupid, pairs); EditorUtility.SetDirty(set); AssetDatabase.SaveAssets(); } catch (Exception e) { Debug.LogError("error while saving imported translations:" + e.Message + " stack:" + e.StackTrace); } }
public void testLanguageListGetterWithNoList() { //LanguageList list = ResourceLoadAdapter.getLanguageList(); //Assets/Transfluent/Resources/LanguageList.asset string languageListPath = "Assets/Transfluent/Resources/LanguageList.asset"; AssetDatabase.DeleteAsset(languageListPath); IWebService service = new SyncronousEditorWebRequest(); var request = new RequestAllLanguages(); WebServiceReturnStatus status = service.request(request); LanguageList list = request.Parse(status.text); Assert.NotNull(list); Assert.NotNull(list.languages); Assert.Greater(list.languages.Count, 0); var so = ResourceCreator.CreateSO <LanguageListSO>("LanguageList"); so.list = list; EditorUtility.SetDirty(so); LanguageList newList = ResourceLoadFacade.getLanguageList(); //NOTE: THIS IS THE RUNTIME VERSION... not the editor time version AssetDatabase.SaveAssets(); //manual load var fromDisk = AssetDatabase.LoadAssetAtPath(languageListPath, typeof(LanguageListSO)) as LanguageListSO; Assert.NotNull(fromDisk); Assert.NotNull(fromDisk.list); Assert.NotNull(fromDisk.list.languages); Assert.Greater(fromDisk.list.languages.Count, 0); Debug.Log("newlist:" + JsonWriter.Serialize(newList)); }