public LanguageList getLanguageList()
        {
            allLanguagesSupported = ResourceLoadFacade.getLanguageList();
            if (allLanguagesSupported == null)
            {
                requestAllLanguagesInEditorSynchronous();
                if (allLanguagesSupported != null)
                {
                    //allLanguagesSupported,
                    var languageListSO = ResourceCreator.CreateSO <LanguageListSO>("LanguageList");
                    languageListSO.list = allLanguagesSupported;
                    //do I need to set this dirty?
                }
            }

            return(allLanguagesSupported);
        }
示例#2
0
        public static void downloadTranslationSetsFromLanguageCodeList(List <string> languageCodes, string groupid = null)
        {
            TransfluentEditorWindowMediator mediator = getAuthenticatedMediator();

            if (mediator == null)
            {
                return;
            }

            foreach (string languageCode in languageCodes)
            {
                try
                {
                    mediator.setCurrentLanguageFromLanguageCode(languageCode);
                    TransfluentLanguage currentlanguage = mediator.GetCurrentLanguage();

                    List <TransfluentTranslation> translations = mediator.knownTextEntries(groupid);
                    //Debug.Log("CURRENT LANGUAGE:" + currentlanguage.code + " translation count:" + translations.Count);
                    if (translations.Count > 0)
                    {
                        GameTranslationSet set = GameTranslationGetter.GetTranslaitonSetFromLanguageCode(languageCode) ??
                                                 ResourceCreator.CreateSO <GameTranslationSet>(GameTranslationGetter.fileNameFromLanguageCode(languageCode));

                        set.language = currentlanguage;
                        Dictionary <string, Dictionary <string, string> > groupToTranslationMap = groupidToDictionaryMap(translations);
                        foreach (var kvp in groupToTranslationMap)
                        {
                            Dictionary <string, string> dictionaryOfStrings = kvp.Value;
                            if (languageCode.Equals("xx-xx"))                            //backwards string
                            {
                                dictionaryOfStrings = cleanBackwardsLanguageStringDictionary(dictionaryOfStrings);
                            }
                            set.mergeInSet(kvp.Key, dictionaryOfStrings);
                        }

                        EditorUtility.SetDirty(set);
                        AssetDatabase.SaveAssets();
                    }
                }
                catch (Exception e)
                {
                    Debug.LogError("error while downloading translations:" + e.Message + " stack:" + e.StackTrace);
                }
            }
        }