public void RefreshConfig(LocalizationType type, bool isDebug, BuildPlatform platform) { string isDebugStr = isDebug ? "_debug.xml" : "_release.xml"; //TODO Fix me string path = Application.dataPath + "/../../Settings/BuildSettings/jenkins_" + platform.ToString() + "_" + type.ToString() + isDebugStr; RefreshConfig(path); }
public static void BuildPcBundles(LocalizationType type) { //刷新配置文件 JenkinsUtils.RefreshConfig(type, true, BuildPlatform.pc); //构建 BuildBundles(BuildTarget.StandaloneWindows); }
public static void BuildIOSBundles(LocalizationType type) { //刷新配置文件 JenkinsUtils.RefreshConfig(type, true, BuildPlatform.ios); //构建 BuildBundles(BuildTarget.iOS); }
public void SetLanguage(LocalizationType languageType) { m_curLanguage = languageType; // 根据语言设置重载本地化表 // string dbPath = Application.persistentDataPath + "/"; // 语言包文件路径; m_dictTextWithId.Clear(); m_dictTextWithAlias.Clear(); // 从dbPath读取数据,加入两个dict // Console.Instance ().Debug (dbPath); SQLiteHelper helper = new SQLiteHelper("Localization.db"); SqliteDataReader reader = helper.ExecuteQuery("SELECT * FROM Localization"); int idOrdinal = reader.GetOrdinal("ID"); int aliasOrdinal = reader.GetOrdinal("Alias"); int textOridinal = reader.GetOrdinal(m_curLanguage.ToString()); while (reader.Read()) { int nId = reader.GetInt32(idOrdinal); string strAlias = reader.GetString(aliasOrdinal); string strText = reader.GetString(textOridinal); m_dictTextWithId [nId] = strText; m_dictTextWithAlias [strAlias] = strText; } reader.Close(); helper.CloseConnection(); Debug.LogFormat("加载了{0}条本地化记录", m_dictTextWithId.Count); }
public static Models.Localization Get(string portalId, LocalizationType type, string ns, string key, string locale) { return Repository.Current.GetResources<Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId && l.Data.Namespace == ns && l.Data.Key == key && ((string.IsNullOrEmpty(l.Data.Locale) && string.IsNullOrEmpty(locale) ) || (l.Data.Locale == locale )) ).Select(l => l.Data).SingleOrDefault(); }
public static void SetLanguage(LocalizationType lan) { if (language != lan) { language = lan; reloadLocalizationStrings(); RFManager.Ins.DoCommand("ChangeLanguage"); } }
public static Models.Localization Get(string portalId, LocalizationType type, string ns, string key, string locale) { return(Repository.Current.GetResources <Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId && l.Data.Namespace == ns && l.Data.Key == key && ((string.IsNullOrEmpty(l.Data.Locale) && string.IsNullOrEmpty(locale)) || (l.Data.Locale == locale)) ).Select(l => l.Data).SingleOrDefault()); }
public static List <Models.Localization> GetLocalizations(LocalizationType type, Func <Models.Localization, bool> query, string portalId = null) { portalId = string.IsNullOrEmpty(portalId) ? Services.Portal.CurrentPortalId : portalId; //var locs = Get(type, portalId).Where(query); var queries = GetLocalizationQueries(portalId, portalId, CurrentUserLocale); //GetLocalizationQueries(CurrentUserLocale); var resourceLocs = Repository.Current.GetResources <Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId && l.Data.Key.EndsWith(".Client")); return(Repository.Current.GetResources <Models.Localization>(resourceLocs, queries, true).Select(r => r.Data).ToList()); //return queries.GetMatches(locs, true); }
private string GetLocalizedLookupByKey(string lookupKey, LocalizationType localizationType = LocalizationType.Default) { var localizedLookupByKey = GetLocalizationForKey(typeof(LookupLocalization).Name, lookupKey, localizationType); if (string.IsNullOrWhiteSpace(localizedLookupByKey)) { return(lookupKey); } return(localizedLookupByKey); }
public virtual TData From(LocalizationType localization) { for (int i = 0; i < elements.Length; i++) { if (elements[i].Localization == localization) { return(elements[i].Value); } } return(Default); }
public static string From(LocalizationType type) { for (int i = 0; i < list.Length; i++) { if (list[i].Type == type) { return(list[i].Code); } } throw new NotImplementedException(); }
public virtual LocalizationPreset Get(LocalizationType type) { for (int i = 0; i < Count; i++) { if (this[i].Type == type) { return(this[i]); } } return(null); }
public virtual void Progress() { IList values = Enum.GetValues(typeof(LocalizationType)); var index = values.IndexOf(target); if (index + 1 < values.Count) { Target = (LocalizationType)values[index + 1]; } else { Target = (LocalizationType)values[0]; } }
private void LocalizationPopup() { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); LocalizationType selectType = (LocalizationType)EditorGUILayout.Popup((int)Localization.CurrentType, Localization.LOCALIZATION_LABEL, GUILayout.Width(150)); if (EditorGUI.EndChangeCheck()) { Localization.SetLocalizationType(selectType); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.Space(); }
public static string GetLocalization(LocalizationType type, string key, string defaultText, string ns, string locale = null, string portalId = null, bool create = true) { locale = string.IsNullOrEmpty(locale) ? CurrentUserLocale : locale; portalId = string.IsNullOrEmpty(portalId) ? Services.Portal.CurrentPortalId : portalId; var text = defaultText; var loc = Repository.Current.GetResourceData <Models.Localization>(type.ToString(), key, GetLocalizationQueries(portalId, ns, locale), null); if (loc == null && create) { Services.Localization.Save(new Models.Localization() { Type = type, Key = key, Namespace = ns, Locale = null, PortalId = portalId, Text = defaultText }, Services.Account.AuditId); } else { text = loc.Text; } return(text); }
public static List<Models.Localization> Get(LocalizationType type, string portalId) { return Repository.Current.GetResources<Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId).Select(l => l.Data).ToList(); }
public static void BuildWebGLBundle(LocalizationType type) { JenkinsUtils.RefreshConfig(type, true, BuildPlatform.webgl); BuildBundles(BuildTarget.WebGL); }
public static List<Models.Localization> Get(LocalizationType type, string portalId, string ns) { return Repository.Current.GetResources<Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId && l.Data.Namespace.IndexOf(ns) == 0).Select(l => l.Data).ToList(); }
public bool Contains(LocalizationType type) { return(Contains(LocalizationCode.From(type))); }
public static List <Models.Localization> Get(LocalizationType type, string portalId, string ns) { return(Repository.Current.GetResources <Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId && l.Data.Namespace.IndexOf(ns) == 0).Select(l => l.Data).ToList()); }
public Element(LocalizationType type, Material value) : base(type, value) { }
public static string GetPathToLocalizationFiles(LocalizationType localizationType) { return(string.Concat(PATH_TO_DATA, PATH_TO_LOCALIZATION_FILES, localizationType.ToString(), "/")); }
public virtual string GetLocalizedEnum <TEnum>(TEnum enumValue, LocalizationType localizationType = LocalizationType.Default) { return(GetLocalizedEnumByKey(string.Format("{0}_{1}", enumValue.GetType().Name, enumValue), localizationType) ?? enumValue.ToString()); }
public static List <Models.Localization> Get(LocalizationType type, string portalId) { return(Repository.Current.GetResources <Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId).Select(l => l.Data).ToList()); }
public Element(LocalizationType localization, TValue value) { this.localization = localization; this.value = value; }
private void Initialize() { var english = new Dictionary <string, string> { { "Lanquage", "Lanquage" }, { "Sound", "Sound" }, { "Effects", "Effects" }, { "Support", "Next" }, { "Load", "Load" }, { "Start", "Start" }, { "Art", "Art" }, { "autor1", "Anatoli Zaicev" }, { "Programming", "Programming" }, { "autor2", "Stanislav Nos" }, { "new", "New Game" }, { "continue", "Continue" }, { "Loading", "Loading" }, { "baraban", "Show/Hide" }, { "settings", "Settings" }, { "hide", "Hide" }, { "back", "Back" } }; var russian = new Dictionary <string, string> { { "Lanquage", "Языкъ" }, { "Sound", "Музыка" }, { "Effects", "Звук" }, { "Support", "Продолжить" }, { "Load", "Загрузить" }, { "Start", "Стреляться" }, { "Art", "Художник" }, { "autor1", "Анатолий Зайцев" }, { "Programming", "Кудесник кода" }, { "autor2", "Станислав Нос" }, { "new", "Cначала" }, { "continue", "Продолжить" }, { "Loading", "Загрузка" }, { "baraban", "Показать/Скрыть" }, { "settings", "Настройки" }, { "hide", "Скрыть" }, { "back", "Назад" } }; var belarus = new Dictionary <string, string> { { "Lanquage", "Мова" }, { "Sound", "Музыка" }, { "Effects", "іншы гук" }, { "Support", "Далей" }, { "Load", "Загрузить" }, { "Start", "Страляцца" }, { "Art", "Мастак" }, { "autor1", "Анатоль Зайцаў" }, { "Programming", "Праграміст" }, { "autor2", "Станіслаў Нос" }, { "new", "Спачатку" }, { "continue", "Застацца" }, { "Loading", "Пампуецца" }, { "baraban", "Паказаць / Прыбраць" }, { "settings", "Налады" }, { "hide", "Hide" }, { "back", "Вярнуцца" } }; localizationLibrary = new Dictionary <string, Dictionary <string, string> > { { "English", english }, { "Belarussian", belarus }, { "Russian", russian } }; var i = PlayerPrefs.GetInt("localize", 0); Debug.Log("Load LocalizationType " + i); Localization = (LocalizationType)i; }
public string this[LocalizationType type] => Get(type);
public static void SetLocalizationType(LocalizationType type) { string cfgPath = $"{FinalPatchConst.LOCALIZATION_DIR}/{type.ToString().ToLower()}{FinalPatchConst.LOCALIZATION_EXT}"; bool found = false; try { using (FileStream fs = File.Open(cfgPath, FileMode.Open, FileAccess.Read)) { XmlSerializer serializer = new XmlSerializer(typeof(LocalizationData)); LocalizationData data = serializer.Deserialize(fs) as LocalizationData; if (s_localizationMap == null) { s_localizationMap = new Dictionary <string, string>(); } s_localizationMap.Clear(); foreach (var item in data.items) { s_localizationMap.Add(item.Key, item.Value); } found = true; CurrentType = type; EditorPrefs.SetInt(FinalPatchConst.KEY_FINAL_PATCH_LOCALIZATION, (int)type); OnLanguageChanged?.Invoke(); } } catch { } if (!found) { // create localization file LocalizationData data = new LocalizationData() { items = new List <LocalizationItem>() { new LocalizationItem() { Key = "localization_key", Value = "localization_value", } } }; string dir = Path.GetDirectoryName(cfgPath); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } using (FileStream fs = new FileStream(cfgPath, FileMode.Create, FileAccess.Write)) { XmlSerializer serializer = new XmlSerializer(typeof(LocalizationData)); serializer.Serialize(fs, data); } Debug.LogFormat("Create Localization File:{0}", cfgPath); AssetDatabase.Refresh(); SetLocalizationType(type); } }
void LocalizationTargetChanged(LocalizationType target) { UpdateState(); }
public static void RefreshConfig(LocalizationType type, bool isDebug, BuildPlatform platform) { JenkinsBuildConfig.Instance.RefreshConfig(type, isDebug, platform); }
public virtual string Get(string ID, LocalizationType code) { return(Get(ID, LocalizationCode.From(code))); }
private void LocalizationTargetChangedCallback(LocalizationType target) { UpdateState(); }
protected override void TargetChangeCallback(LocalizationType type) { base.TargetChangeCallback(type); UpdateState(); }
public static void Initialize(LocalizationType type) { Language = type.ToString(); }
public static string GetLocalization(LocalizationType type, string key, string defaultText, string ns, string locale = null, string portalId = null, bool create = true) { locale = string.IsNullOrEmpty(locale) ? CurrentUserLocale : locale; portalId = string.IsNullOrEmpty(portalId) ? Services.Portal.CurrentPortalId : portalId; var text = defaultText; var loc = Repository.Current.GetResourceData<Models.Localization>(type.ToString(), key, GetLocalizationQueries(portalId, ns, locale), null); if (loc == null && create) Services.Localization.Save(new Models.Localization() { Type = type, Key = key, Namespace = ns, Locale = null, PortalId = portalId, Text = defaultText }, Services.Account.AuditId); else text = loc.Text; return text; }
public static void BuildWPBundle(LocalizationType type) { JenkinsUtils.RefreshConfig(type, true, BuildPlatform.wp8); BuildBundles(BuildTarget.WP8Player); }
public static List<Models.Localization> GetLocalizations(LocalizationType type, Func<Models.Localization, bool> query, string portalId = null) { portalId = string.IsNullOrEmpty(portalId) ? Services.Portal.CurrentPortalId : portalId; //var locs = Get(type, portalId).Where(query); var queries = GetLocalizationQueries(portalId, portalId, CurrentUserLocale); //GetLocalizationQueries(CurrentUserLocale); var resourceLocs = Repository.Current.GetResources<Models.Localization>(type.ToString(), l => l.Data.PortalId == portalId && l.Data.Key.EndsWith(".Client")); return Repository.Current.GetResources<Models.Localization>(resourceLocs, queries, true).Select(r => r.Data).ToList(); //return queries.GetMatches(locs, true); }
private string GetLocalizedEnumByKey(string enumKey, LocalizationType localizationType = LocalizationType.Default) { return(GetLocalizationForKey(typeof(EnumLocalization).Name, enumKey, localizationType)); }
public string Get(LocalizationType type) { return(Get(LocalizationCode.From(type))); }
protected string GetLocalizationForKey(string classKey, string resourceEntryKey, LocalizationType localizationType) { var localizedValue = GetLocalizationForKey(classKey, string.Format("{0}_{1}", localizationType, resourceEntryKey)); if (localizationType == LocalizationType.Default || string.IsNullOrEmpty(localizedValue)) { return(GetLocalizationForKey(classKey, resourceEntryKey)); } return(localizedValue); }
public string GetLocalizedBelastungskategorieTyp(string belastungskategorieTyp, LocalizationType localizationType = LocalizationType.Default) { return(GetLocalizedLookupByKey(belastungskategorieTyp, localizationType)); }
public static void ControlLocalized(LocalizationType localizationType) { LocalizationConfigHandler.RuntimeLocalizationType = localizationType; ControlLocalized(); }
public override string GetLocalizedEnum <TEnum>(TEnum enumValue, LocalizationType localizationType = LocalizationType.Default) { return(enumValue.ToString()); }