public static void SaveStrings() { foreach (KeyValuePair <string, LocalisationMap> languagePair in _localisationMaps) { SystemLanguage languageCode = LanguageCodes.GetLanguageFromCode(languagePair.Key); if (languageCode != SystemLanguage.Unknown) { string resourceName = GetLocalisationMapName(languageCode); string assetsPath = LocalisationProjectSettings.Get()._localisationFolder; string resourcePath = AssetUtils.GetResourcePath(assetsPath) + "/" + resourceName; string filePath = AssetUtils.GetAppllicationPath(); TextAsset asset = Resources.Load(resourcePath) as TextAsset; if (asset != null) { filePath += AssetDatabase.GetAssetPath(asset); } else { filePath += assetsPath + "/" + resourceName + ".xml"; } languagePair.Value._language = LanguageCodes.GetLanguageFromCode(languagePair.Key); languagePair.Value.SortStrings(); Serializer.ToFile(languagePair.Value, filePath); } } _dirty = false; }
public static void ReloadStrings(bool warnIfDirty = false) { if (warnIfDirty) { EditorWarnIfDirty(); } string[] languageCodes = new string[_localisationMaps.Keys.Count]; _localisationMaps.Keys.CopyTo(languageCodes, 0); foreach (string languageCode in languageCodes) { SystemLanguage language = LanguageCodes.GetLanguageFromCode(languageCode); LoadStrings(language); } _dirty = false; }