public void DoLocalize_uGUI_Text(string mainTranslation, string secondaryTranslation) { //--[ Localize Font Object ]---------- Font newFont = GetSecondaryTranslatedObj <Font>(ref mainTranslation, ref secondaryTranslation); if (newFont != null && newFont != mTarget_uGUI_Text.font) { mTarget_uGUI_Text.font = newFont; } if (mInitializeAlignment) { mInitializeAlignment = false; mAlignmentUGUIwasRTL = LocalizationManager.IsRight2Left; InitAlignment_UGUI(mAlignmentUGUIwasRTL, mTarget_uGUI_Text.alignment, out mAlignmentUGUI_LTR, out mAlignmentUGUI_RTL); } else { TextAnchor alignRTL, alignLTR; InitAlignment_UGUI(mAlignmentUGUIwasRTL, mTarget_uGUI_Text.alignment, out alignLTR, out alignRTL); if ((mAlignmentUGUIwasRTL && mAlignmentUGUI_RTL != alignRTL) || (!mAlignmentUGUIwasRTL && mAlignmentUGUI_LTR != alignLTR)) { mAlignmentUGUI_LTR = alignLTR; mAlignmentUGUI_RTL = alignRTL; } mAlignmentUGUIwasRTL = LocalizationManager.IsRight2Left; } if (mainTranslation != null && mTarget_uGUI_Text.text != mainTranslation) { if (CurrentLocalizeComponent.CorrectAlignmentForRTL) { mTarget_uGUI_Text.alignment = LocalizationManager.IsRight2Left ? mAlignmentUGUI_RTL : mAlignmentUGUI_LTR; } mTarget_uGUI_Text.text = mainTranslation; mTarget_uGUI_Text.SetVerticesDirty(); // In the editor, sometimes unity "forgets" to show the changes #if UNITY_EDITOR if (!Application.isPlaying) { UnityEditor.EditorUtility.SetDirty(mTarget_uGUI_Text); } #endif } }
public void DoLocalize_uGUI_Text(string MainTranslation, string SecondaryTranslation) { //--[ Localize Font Object ]---------- Font newFont = GetSecondaryTranslatedObj <Font>(ref MainTranslation, ref SecondaryTranslation); if (newFont != null && newFont != mTarget_uGUI_Text.font) { mTarget_uGUI_Text.font = newFont; } if (mInitializeAlignment) { mInitializeAlignment = false; mOriginalAlignmentUGUI = mTarget_uGUI_Text.alignment; } if (!string.IsNullOrEmpty(MainTranslation) && mTarget_uGUI_Text.text != MainTranslation) { if (Localize.CurrentLocalizeComponent.CorrectAlignmentForRTL) { if (mTarget_uGUI_Text.alignment == TextAnchor.UpperLeft || mTarget_uGUI_Text.alignment == TextAnchor.UpperRight) { mTarget_uGUI_Text.alignment = LocalizationManager.IsRight2Left ? TextAnchor.UpperRight : mOriginalAlignmentUGUI; } else if (mTarget_uGUI_Text.alignment == TextAnchor.MiddleLeft || mTarget_uGUI_Text.alignment == TextAnchor.MiddleRight) { mTarget_uGUI_Text.alignment = LocalizationManager.IsRight2Left ? TextAnchor.MiddleRight : mOriginalAlignmentUGUI; } else if (mTarget_uGUI_Text.alignment == TextAnchor.LowerLeft || mTarget_uGUI_Text.alignment == TextAnchor.LowerRight) { mTarget_uGUI_Text.alignment = LocalizationManager.IsRight2Left ? TextAnchor.LowerRight : mOriginalAlignmentUGUI; } } mTarget_uGUI_Text.text = MainTranslation; mTarget_uGUI_Text.SetVerticesDirty(); } }
public void DoLocalize_uGUI_Text(string MainTranslation, string SecondaryTranslation) { //--[ Localize Font Object ]---------- Font newFont = GetSecondaryTranslatedObj <Font>(ref MainTranslation, ref SecondaryTranslation); if (newFont != null && newFont != mTarget_uGUI_Text.font) { mTarget_uGUI_Text.font = newFont; } if (mInitializeAlignment) { mInitializeAlignment = false; InitAlignment_UGUI(mTarget_uGUI_Text.alignment, out mAlignmentUGUI_LTR, out mAlignmentUGUI_RTL); } if (!string.IsNullOrEmpty(MainTranslation) && mTarget_uGUI_Text.text != MainTranslation) { if (Localize.CurrentLocalizeComponent.CorrectAlignmentForRTL) { mTarget_uGUI_Text.alignment = LocalizationManager.IsRight2Left ? mAlignmentUGUI_RTL : mAlignmentUGUI_LTR; } mTarget_uGUI_Text.text = MainTranslation; mTarget_uGUI_Text.SetVerticesDirty(); // In the editor, sometimes unity "forgets" to show the changes #if UNITY_EDITOR if (!Application.isPlaying) { UnityEditor.EditorUtility.SetDirty(mTarget_uGUI_Text); } #endif } }