Esempio n. 1
0
        public static IEnumerable <LanguageData> CreateAll(IEnumerable <string> translatableKeys)
        {
            LanguageDictionaryFactory languageDictionaryFactory = new LanguageDictionaryFactory(translatableKeys);
            LanguageDataReader        languageDataReader        = new LanguageDataReader(languageDictionaryFactory);

            return(languageDataReader.ReadAll().Select(dictionary => new LanguageData(dictionary.code, new LanguageTranslator(dictionary.dictionary, dictionary.fontAsset))));
        }
Esempio n. 2
0
        public static ILanguageTranslator Create(string languageCode, IEnumerable <string> translatableKeys)
        {
            LanguageDictionaryFactory languageDictionaryFactory = new LanguageDictionaryFactory(translatableKeys);
            LanguageDataReader        languageDataReader        = new LanguageDataReader(languageDictionaryFactory);
            var pair = languageDataReader.Read(languageCode);

            if (pair.dictionary == null)
            {
                UnityEngine.Debug.LogError("Language translator generation failed");
                return(new EmptyTranslator());
            }

            return(new LanguageTranslator(pair.dictionary, pair.fontAsset));
        }