void OnGUI_StoreIntegration() { GUIStyle lstyle = new GUIStyle(EditorStyles.label); lstyle.richText = true; GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Store Integration:", "Setups the stores to detect that the game has localization, Android adds strings.xml for each language. IOS modifies the Info.plist"), EditorStyles.boldLabel, GUILayout.Width(160)); GUILayout.FlexibleSpace(); GUILayout.Label(new GUIContent("<color=green><size=16>\u2713</size></color> IOS", "Setups the stores to show in iTunes and the Appstore all the languages that this app supports, also localizes the app name if available"), lstyle, GUILayout.Width(90)); GUILayout.Label(new GUIContent("<color=green><size=16>\u2713</size></color> Android", "Setups the stores to show in GooglePlay all the languages this app supports, also localizes the app name if available"), lstyle, GUILayout.Width(90)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); mAppNameTerm_Expanded = GUILayout.Toggle(mAppNameTerm_Expanded, new GUIContent("App Name translations:", "How should the game be named in the devices based on their language"), EditorStyles.foldout, GUILayout.Width(160)); GUILayout.Label("", GUILayout.ExpandWidth(true)); var rect = GUILayoutUtility.GetLastRect(); TermsPopup_Drawer.ShowGUI(rect, mProp_AppNameTerm, GUITools.EmptyContent, mLanguageSource); if (GUILayout.Button("New Term", EditorStyles.miniButton, GUILayout.ExpandWidth(false))) { AddLocalTerm("App_Name"); mProp_AppNameTerm.stringValue = "App_Name"; mAppNameTerm_Expanded = true; } GUILayout.EndHorizontal(); if (mAppNameTerm_Expanded) { GUILayout.BeginHorizontal(); GUILayout.Space(10); GUILayout.BeginVertical("Box"); var termName = mProp_AppNameTerm.stringValue; if (!string.IsNullOrEmpty(termName)) { var termData = LocalizationManager.GetTermData(termName); if (termData != null) { OnGUI_Keys_Languages(mProp_AppNameTerm.stringValue, ref termData, null, true, mLanguageSource); } } GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("<b>Default App Name:</b>", lstyle, GUITools.DontExpandWidth); GUILayout.Label(Application.productName); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } }
public override bool FindTarget(Localize cmp) { if ((cmp.mTarget as GameObject) != null) { return(true); } var termData = LocalizationManager.GetTermData(cmp.Term); return(termData != null && termData.TermType == eTermType.GameObject); }
public void OnModifyLocalization() { string Language = "English"; string term, secondary; GetComponent <I2.Loc.Localize>().GetFinalTerms(out term, out secondary); var termData = LocalizationManager.GetTermData(term); int LanguageIndex = LocalizationManager.Sources[0].GetLanguageIndex(Language); if (LanguageIndex >= 0) { Localize.MainTranslation = termData.Languages[LanguageIndex]; } }
void RemoveUnusedReferences(Localize cmp) { cmp.TranslatedObjects.RemoveAll(x => !IsUsingReference(LocalizationManager.GetTermData(cmp.Term), x) && !IsUsingReference(LocalizationManager.GetTermData(cmp.SecondaryTerm), x)); if (cmp.TranslatedObjects.Count != cmp.mAssetDictionary.Count) { cmp.UpdateAssetDictionary(); } }
public static void ApplyLocalizationParams(ref string translation, _GetParam getParam, bool allowLocalizedParameters = true) { if (translation == null) { return; } string pluralType = null; int idx0 = 0; int idx1 = translation.Length; int index = 0; while (index >= 0 && index < translation.Length) { int iParamStart = translation.IndexOf("{[", index); if (iParamStart < 0) { break; } int iParamEnd = translation.IndexOf("]}", iParamStart); if (iParamEnd < 0) { break; } // there is a sub param, so, skip this one: "this {[helo{[hi]} end" int isubParam = translation.IndexOf("{[", iParamStart + 1); if (isubParam > 0 && isubParam < iParamEnd) { index = isubParam; continue; } // Check that some plural parameters can have the form: {[#name]} var offset = translation[iParamStart + 2] == '#' ? 3 : 2; var param = translation.Substring(iParamStart + offset, iParamEnd - iParamStart - offset); var result = (string)getParam(param); if (result != null && allowLocalizedParameters) { // check if Param is Localized LanguageSourceData source; var termData = LocalizationManager.GetTermData(result, out source); if (termData != null) { int idx = source.GetLanguageIndex(LocalizationManager.CurrentLanguage); if (idx >= 0) { result = termData.GetTranslation(idx); } } var paramTag = translation.Substring(iParamStart, iParamEnd - iParamStart + 2); translation = translation.Replace(paramTag, result); int amount = 0; if (int.TryParse(result, out amount)) { pluralType = GoogleLanguages.GetPluralType(CurrentLanguageCode, amount).ToString(); } index = iParamStart + result.Length; } else { index = iParamEnd + 2; } } if (pluralType != null) { var tag = "[i2p_" + pluralType + "]"; idx0 = translation.IndexOf(tag, System.StringComparison.OrdinalIgnoreCase); if (idx0 < 0) { idx0 = 0; } else { idx0 += tag.Length; } idx1 = translation.IndexOf("[i2p_", idx0 + 1, System.StringComparison.OrdinalIgnoreCase); if (idx1 < 0) { idx1 = translation.Length; } translation = translation.Substring(idx0, idx1 - idx0); } }
public override bool FindTarget(Localize cmp) { var termData = LocalizationManager.GetTermData(cmp.Term); return(termData != null && termData.TermType == eTermType.Child); }