From: minho.sun Date: Mon, 14 Aug 2017 11:08:21 +0000 (+0900) Subject: Revert "[Tizen] Add translatable text in TextLabel, TextField, TextEditor X-Git-Tag: preview1-00180^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23e417a77d7afc7d84b700b673aad236cae34286;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Revert "[Tizen] Add translatable text in TextLabel, TextField, TextEditor This reverts commit fc35898aa808f1ef2a5bb693a6cf60951e2676d1. Change-Id: Ia50b62f5275d375a207f5f96c68db41f015871b3 --- diff --git a/packaging/csapi-nui.spec b/packaging/csapi-nui.spec index 87a3cf6..ae85cbd 100755 --- a/packaging/csapi-nui.spec +++ b/packaging/csapi-nui.spec @@ -18,7 +18,6 @@ BuildRequires: dotnet-build-tools BuildRequires: csapi-tizen-nuget BuildRequires: csapi-application-common-nuget BuildRequires: csapi-application-ui-nuget -BuildRequires: csapi-system-settings-nuget %define Assemblies Tizen.NUI diff --git a/src/Tizen.NUI/Tizen.NUI.csproj b/src/Tizen.NUI/Tizen.NUI.csproj index eb039ad..006c8f1 100755 --- a/src/Tizen.NUI/Tizen.NUI.csproj +++ b/src/Tizen.NUI/Tizen.NUI.csproj @@ -25,15 +25,8 @@ - - + - - - - TizenSystemSettings - - - + diff --git a/src/Tizen.NUI/src/internal/WeakEventHandler.cs b/src/Tizen.NUI/src/internal/WeakEventHandler.cs deleted file mode 100755 index b78ee88..0000000 --- a/src/Tizen.NUI/src/internal/WeakEventHandler.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Reflection; - -namespace Tizen.NUI -{ - internal sealed class WeakEventHandler where TEventArgs : EventArgs - { - private readonly WeakReference _targetReference; - private readonly MethodInfo _method; - - public WeakEventHandler(EventHandler callback) - { - _method = callback.GetMethodInfo(); - _targetReference = new WeakReference(callback.Target, true); - } - - public void Handler(object sender, TEventArgs e) - { - var target = _targetReference.Target; - if (target != null) - { - var callback = (Action)_method.CreateDelegate(typeof(Action), target); - if (callback != null) - { - callback(sender, e); - } - } - } -} - -} - diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index eaff977..9f3e819 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -14,14 +14,11 @@ * */ -extern alias TizenSystemSettings; -using TizenSystemSettings.Tizen.System; namespace Tizen.NUI.BaseComponents { using System; using System.Runtime.InteropServices; - using System.Globalization; /// /// A control which provides a multi-line editable text editor. @@ -29,9 +26,6 @@ namespace Tizen.NUI.BaseComponents public class TextEditor : View { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - private string textEditorTextSid = null; - private string textEditorPlaceHolderTextSid = null; - private bool systemlangTextFlag = false; internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextEditor_SWIGUpcast(cPtr), cMemoryOwn) { @@ -353,81 +347,6 @@ namespace Tizen.NUI.BaseComponents } /// - /// TranslatableText property.
- /// The text can be set SID value.
- ///
- /// - /// ResourceManager about multilingual is null - /// - public string TranslatableText - { - get - { - return textEditorTextSid; - } - set - { - if (NUIApplication.MultilingualResourceManager == null) - { - throw new ArgumentNullException("ResourceManager about multilingual is null"); - } - textEditorTextSid = value; - Text = SetTranslatable(textEditorTextSid); - } - } - /// - /// TranslatablePlaceholderText property.
- /// The text can be set SID value.
- ///
- /// - /// ResourceManager about multilingual is null - /// - public string TranslatablePlaceholderText - { - get - { - return textEditorPlaceHolderTextSid; - } - set - { - if (NUIApplication.MultilingualResourceManager == null) - { - throw new ArgumentNullException("ResourceManager about multilingual is null"); - } - textEditorPlaceHolderTextSid = value; - PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid); - } - } - private string SetTranslatable(string textEditorSid) - { - string translatableText = null; - translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); - if (translatableText != null) - { - if (systemlangTextFlag == false) - { - SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler; - systemlangTextFlag = true; - } - return translatableText; - } - else - { - translatableText = ""; - return translatableText; - } - } - private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) - { - if (textEditorTextSid != null) - { - Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-"))); - } - if (textEditorPlaceHolderTextSid != null) - { - PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-"))); - } - } /// Text property. ///
public string Text diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index 09dc7d7..6d0d4fa 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -13,23 +13,19 @@ * limitations under the License. * */ -extern alias TizenSystemSettings; -using TizenSystemSettings.Tizen.System; + namespace Tizen.NUI.BaseComponents { using System; using System.Runtime.InteropServices; - using System.Globalization; + /// /// A control which provides a single-line editable text field. /// public class TextField : View { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - private string textFieldTextSid = null; - private string textFieldPlaceHolderTextSid = null; - private bool systemlangTextFlag = false; internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextField_SWIGUpcast(cPtr), cMemoryOwn) { @@ -343,81 +339,6 @@ namespace Tizen.NUI.BaseComponents } /// - /// TranslatableText property.
- /// The text can be set SID value.
- ///
- /// - /// ResourceManager about multilingual is null - /// - public string TranslatableText - { - get - { - return textFieldTextSid; - } - set - { - if (NUIApplication.MultilingualResourceManager == null) - { - throw new ArgumentNullException("ResourceManager about multilingual is null"); - } - textFieldTextSid = value; - Text = SetTranslatable(textFieldTextSid); - } - } - /// - /// TranslatablePlaceholderText property.
- /// The text can be set SID value.
- ///
- /// - /// ResourceManager about multilingual is null - /// - public string TranslatablePlaceholderText - { - get - { - return textFieldPlaceHolderTextSid; - } - set - { - if (NUIApplication.MultilingualResourceManager == null) - { - throw new ArgumentNullException("ResourceManager about multilingual is null"); - } - textFieldPlaceHolderTextSid = value; - PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid); - } - } - private string SetTranslatable(string textFieldSid) - { - string translatableText = null; - translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); - if (translatableText != null) - { - if (systemlangTextFlag == false) - { - SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler; - systemlangTextFlag = true; - } - return translatableText; - } - else - { - translatableText = ""; - return translatableText; - } - } - private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) - { - if (textFieldTextSid != null) - { - Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-"))); - } - if (textFieldPlaceHolderTextSid != null) - { - PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-"))); - } - } /// Text property. /// public string Text diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 5d52eac..d505da0 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -14,10 +14,8 @@ * */ -extern alias TizenSystemSettings; -using TizenSystemSettings.Tizen.System; using System; -using System.Globalization; + namespace Tizen.NUI.BaseComponents { @@ -28,8 +26,7 @@ namespace Tizen.NUI.BaseComponents public class TextLabel : View { private global::System.Runtime.InteropServices.HandleRef swigCPtr; - private string textLabelSid = null; - private bool systemlangTextFlag = false; + internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextLabel_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); @@ -150,47 +147,6 @@ namespace Tizen.NUI.BaseComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - /// - /// TranslatableText property.
- /// The text can be set SID value.
- ///
- /// - /// ResourceManager about multilingual is null - /// - public string TranslatableText - { - get - { - return textLabelSid; - } - set - { - if (NUIApplication.MultilingualResourceManager == null) - { - throw new ArgumentNullException("ResourceManager about multilingual is null"); - } - string translatableText = null; - textLabelSid = value; - translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); - if (translatableText != null) - { - Text = translatableText; - if (systemlangTextFlag == false) - { - SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler; - systemlangTextFlag = true; - } - } - else - { - Text = ""; - } - } - } - private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) - { - Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-"))); - } /// /// Text property.
diff --git a/src/Tizen.NUI/src/public/NUIApplication.cs b/src/Tizen.NUI/src/public/NUIApplication.cs index 1caf135..b5bdacb 100755 --- a/src/Tizen.NUI/src/public/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/NUIApplication.cs @@ -27,11 +27,7 @@ namespace Tizen.NUI /// Represents an application that have UI screen. The NUIApplication class has a default stage. ///
public class NUIApplication : CoreApplication - { - /// - /// The instance of ResourceManager. - /// - private static System.Resources.ResourceManager resourceManager = null; + { /// /// The default constructor. /// @@ -179,7 +175,6 @@ namespace Tizen.NUI Opaque = 0, Transparent = 1 } -<<<<<<< HEAD internal Application ApplicationHandle @@ -190,21 +185,5 @@ namespace Tizen.NUI } } -======= - /// - /// ResourceManager to handle multilingual - /// - public static System.Resources.ResourceManager MultilingualResourceManager - { - get - { - return resourceManager; - } - set - { - resourceManager = value; - } - } ->>>>>>> 23f9e83... Add translatable text in TextLabel, TextField, TextEditor } }