From: Akshat Airan/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics Date: Thu, 8 Feb 2024 09:32:14 +0000 (+0530) Subject: Added MultilanguageResource Support X-Git-Tag: accepted/tizen/unified/20240424.063517~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b92a30be7c4e9c57108996330118166b178d902;p=profile%2Fiot%2Fapps%2Fdotnet%2Fmusic-player.git Added MultilanguageResource Support Change-Id: If84b3f2854337fe208cf8124eca181d86fff656a Signed-off-by: Akshat Airan/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics --- diff --git a/music-player/Common/MultiResourceManager.cs b/music-player/Common/MultiResourceManager.cs new file mode 100644 index 0000000..eee8e26 --- /dev/null +++ b/music-player/Common/MultiResourceManager.cs @@ -0,0 +1,27 @@ + +using System.Globalization; +using System.Reflection; +using System.Resources; + +namespace MusicPlayer.Common +{ + internal class MultiResourceManager : ResourceManager +{ + public MultiResourceManager(string baseName, Assembly assembly) + : base(baseName, assembly) + { + } + + public override string GetString(string name) + { + return base.GetString(name) + ?? TextResources.Resources.ResourceManager.GetString(name); + } + + public override string GetString(string name, CultureInfo culture) + { + return base.GetString(name, culture) + ?? TextResources.Resources.ResourceManager.GetString(name, culture); + } + } +} diff --git a/music-player/Common/Resources.cs b/music-player/Common/Resources.cs index 7676656..9cc82b4 100755 --- a/music-player/Common/Resources.cs +++ b/music-player/Common/Resources.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - + namespace MusicPlayer.Common { public class Resources diff --git a/music-player/MusicPlayer.cs b/music-player/MusicPlayer.cs index 8755a4b..3da2f3b 100755 --- a/music-player/MusicPlayer.cs +++ b/music-player/MusicPlayer.cs @@ -3,6 +3,7 @@ using System.Text; using Tizen.NUI; using MusicPlayer.Views; using MusicPlayer.Common; +using System.Globalization; namespace MusicPlayer { @@ -15,7 +16,7 @@ namespace MusicPlayer protected override void OnCreate() { - Tizen.Log.Info(AppConstants.LogTag, "OnCreate statrted"); + Tizen.Log.Info(AppConstants.LogTag, "OnCreate started"); base.OnCreate(); //Initlize NUISynchronizationContext @@ -23,6 +24,7 @@ namespace MusicPlayer Window window = Window.Instance; window.Maximize(true); + SetupLanguage(); window.BackgroundColor = Color.White; Size2D size = window.Size; Tizen.Log.Info(AppConstants.LogTag, "Window Size: " + size.Width + "x" + size.Height); @@ -49,6 +51,27 @@ namespace MusicPlayer Environment.Exit(1); } + private void SetupLanguage() + { + void SetLanguage() + { + try + { + string language = Tizen.System.SystemSettings.LocaleLanguage.Replace("_", "-"); + var culture = CultureInfo.CreateSpecificCulture(language); + CultureInfo.CurrentCulture = culture; + TextResources.Resources.Culture = culture; + } + catch (Exception e) + { + Tizen.Log.Debug(AppConstants.LogTag, "Setting Language failed" + e.Message); + } + } + + MultilingualResourceManager = new MultiResourceManager("music-player.TextResources.Resources", typeof(Resources).Assembly); + Tizen.System.SystemSettings.LocaleLanguageChanged += (s, e) => SetLanguage(); + SetLanguage(); + } static void Main(string[] args) { Tizen.Log.Info(AppConstants.LogTag, "Main statrted"); diff --git a/music-player/TextResources/Resources.Designer.cs b/music-player/TextResources/Resources.Designer.cs new file mode 100644 index 0000000..987eddb --- /dev/null +++ b/music-player/TextResources/Resources.Designer.cs @@ -0,0 +1,270 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace MusicPlayer.TextResources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("music-player.TextResources.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Add to playlist. + /// + internal static string ADD_TO_PLAYLIST { + get { + return ResourceManager.GetString("ADD_TO_PLAYLIST", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add. + /// + internal static string IDS_ADD { + get { + return ResourceManager.GetString("IDS_ADD", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add playlist name. + /// + internal static string IDS_ADD_PLAYLIST_NAME { + get { + return ResourceManager.GetString("IDS_ADD_PLAYLIST_NAME", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Albums. + /// + internal static string IDS_ALBUMS { + get { + return ResourceManager.GetString("IDS_ALBUMS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Artists. + /// + internal static string IDS_ARTISTS { + get { + return ResourceManager.GetString("IDS_ARTISTS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cancel. + /// + internal static string IDS_CANCEL { + get { + return ResourceManager.GetString("IDS_CANCEL", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can't enter more than 64 characters.. + /// + internal static string IDS_CANT_ENTER_MORE_CHAR { + get { + return ResourceManager.GetString("IDS_CANT_ENTER_MORE_CHAR", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create. + /// + internal static string IDS_CREATE { + get { + return ResourceManager.GetString("IDS_CREATE", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Create playlist. + /// + internal static string IDS_CREATE_PLAYLIST { + get { + return ResourceManager.GetString("IDS_CREATE_PLAYLIST", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Delete. + /// + internal static string IDS_DELETE { + get { + return ResourceManager.GetString("IDS_DELETE", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Enter Playlist Name. + /// + internal static string IDS_ENTER_PLAYLIST_NAME { + get { + return ResourceManager.GetString("IDS_ENTER_PLAYLIST_NAME", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Music. + /// + internal static string IDS_MUSIC { + get { + return ResourceManager.GetString("IDS_MUSIC", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No items in folder. + /// + internal static string IDS_NO_ITEMS_IN_FOLDER { + get { + return ResourceManager.GetString("IDS_NO_ITEMS_IN_FOLDER", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No playlists available. + /// + internal static string IDS_NO_PLAYLIST_AVAIL { + get { + return ResourceManager.GetString("IDS_NO_PLAYLIST_AVAIL", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No results found. + /// + internal static string IDS_NO_RESULT_FOUND { + get { + return ResourceManager.GetString("IDS_NO_RESULT_FOUND", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Playlist name already in use.. + /// + internal static string IDS_PLAYLIST_NAME_USED { + get { + return ResourceManager.GetString("IDS_PLAYLIST_NAME_USED", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Playlists. + /// + internal static string IDS_PLAYLISTS { + get { + return ResourceManager.GetString("IDS_PLAYLISTS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Remove. + /// + internal static string IDS_REMOVE { + get { + return ResourceManager.GetString("IDS_REMOVE", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Search. + /// + internal static string IDS_SEARCH { + get { + return ResourceManager.GetString("IDS_SEARCH", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Search music. + /// + internal static string IDS_SEARCH_MUSIC { + get { + return ResourceManager.GetString("IDS_SEARCH_MUSIC", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Share. + /// + internal static string IDS_SHARE { + get { + return ResourceManager.GetString("IDS_SHARE", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Tracks. + /// + internal static string IDS_TRACK { + get { + return ResourceManager.GetString("IDS_TRACK", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type Here. + /// + internal static string IDS_TYPE_HERE { + get { + return ResourceManager.GetString("IDS_TYPE_HERE", resourceCulture); + } + } + } +} diff --git a/music-player/TextResources/Resources.en-US.resx b/music-player/TextResources/Resources.en-US.resx new file mode 100644 index 0000000..6ab452d --- /dev/null +++ b/music-player/TextResources/Resources.en-US.resx @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add to playlist + + + Add + + + Add playlist name + + + Albums + + + Artists + + + Cancel + + + Can't enter more than 64 characters. + + + Create + + + Create playlist + + + Delete + + + Enter Playlist Name + + + Music + + + No items in folder + + + No playlists available + + + No results found + + + Playlists + + + Playlist name already in use. + + + Remove + + + Search + + + Search music + + + Share + + + Tracks + + + Type Here + + \ No newline at end of file diff --git a/music-player/TextResources/Resources.ko-KR.resx b/music-player/TextResources/Resources.ko-KR.resx new file mode 100644 index 0000000..e16836b --- /dev/null +++ b/music-player/TextResources/Resources.ko-KR.resx @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 재생 목록에 추가 + + + 더하다 + + + 재생 목록 이름 추가 + + + 앨범 + + + 예술가 + + + 취소 + + + 64자를 초과하여 입력할 수 없습니다. + + + 창조하다 + + + 재생 목록 만들기 + + + 삭제하다 + + + 재생 목록 이름 입력 + + + 음악 + + + 폴더에 항목이 없습니다. + + + 사용 가능한 재생 목록이 없습니다 + + + 결과를 찾을 수 없습니다. + + + 재생 목록 + + + 이미 사용 중인 재생 목록 이름입니다. + + + 제거하다 + + + 검색 + + + 음악 검색 + + + 공유 + + + 트랙 + + + 여기에 입력하십시오 + + \ No newline at end of file diff --git a/music-player/TextResources/Resources.resx b/music-player/TextResources/Resources.resx new file mode 100644 index 0000000..6ab452d --- /dev/null +++ b/music-player/TextResources/Resources.resx @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add to playlist + + + Add + + + Add playlist name + + + Albums + + + Artists + + + Cancel + + + Can't enter more than 64 characters. + + + Create + + + Create playlist + + + Delete + + + Enter Playlist Name + + + Music + + + No items in folder + + + No playlists available + + + No results found + + + Playlists + + + Playlist name already in use. + + + Remove + + + Search + + + Search music + + + Share + + + Tracks + + + Type Here + + \ No newline at end of file diff --git a/music-player/Views/BaseContentView.cs b/music-player/Views/BaseContentView.cs index de345fe..618deba 100755 --- a/music-player/Views/BaseContentView.cs +++ b/music-player/Views/BaseContentView.cs @@ -155,7 +155,7 @@ namespace MusicPlayer.Views { StyleName = "TitleText", Size2D = new Size2D(234, 36).SpToPx(), - Text = "No items in folder", + TranslatableText = "IDS_NO_ITEMS_IN_FOLDER", PixelSize = 24.SpToPx(), FontFamily = "BreezeSans", HorizontalAlignment = HorizontalAlignment.Center, diff --git a/music-player/Views/BaseSubContentView.cs b/music-player/Views/BaseSubContentView.cs index e8a38f6..0b409de 100755 --- a/music-player/Views/BaseSubContentView.cs +++ b/music-player/Views/BaseSubContentView.cs @@ -152,7 +152,7 @@ namespace MusicPlayer.Views { StyleName = "TitleText", Size2D = new Size2D(234, 36).SpToPx(), - Text = "No items in folder", + TranslatableText = "IDS_NO_ITEMS_IN_FOLDER", PixelSize = 24.SpToPx(), FontFamily = "BreezeSans", HorizontalAlignment = HorizontalAlignment.Center, diff --git a/music-player/Views/BaseView.cs b/music-player/Views/BaseView.cs index c351104..8cb1db0 100755 --- a/music-player/Views/BaseView.cs +++ b/music-player/Views/BaseView.cs @@ -26,6 +26,10 @@ namespace MusicPlayer.Views "Tracks", "Albums", "Artists", + //"IDS_PLAYLIST", + //"IDS_TRACK", + //"IDS_ALBUMS", + //"IDS_ARTISTS", }; public BaseView() : base() { @@ -55,7 +59,6 @@ namespace MusicPlayer.Views { StyleName = "PageLabel", ThemeChangeSensitive = true, - Text = "Music", PixelSize = 40.SpToPx(), FontFamily = "BreezeSans", HorizontalAlignment = HorizontalAlignment.Begin, @@ -64,7 +67,7 @@ namespace MusicPlayer.Views FontStyle = UIFontStyles.NormalLight, }; topView.Add(titleLabel); - titleLabel.SetBinding(TextLabel.TextProperty, "Title"); + titleLabel.SetBinding(TextLabel.TranslatableTextProperty, "Title"); RelativeLayout.SetLeftTarget(titleLabel, topView); RelativeLayout.SetLeftRelativeOffset(titleLabel, 0.0f); RelativeLayout.SetRightTarget(titleLabel, topView); @@ -110,8 +113,8 @@ namespace MusicPlayer.Views public string Title { - get => titleLabel.Text; - set { titleLabel.Text = value;} + get => titleLabel.TranslatableText; + set { titleLabel.TranslatableText = value;} } public bool BackButton @@ -223,7 +226,7 @@ namespace MusicPlayer.Views else { BackButton = false; - Title = "Music"; + Title = "IDS_MUSIC"; } contentView.Add(view); baseContentView = view; @@ -299,7 +302,7 @@ namespace MusicPlayer.Views if (baseContentView != null) { BackButton = false; - Title = "Music"; + Title = "IDS_Music"; baseContentView.RemoveSubContentView(); } } diff --git a/music-player/Views/PlaylistDetailView.cs b/music-player/Views/PlaylistDetailView.cs index ba5966e..4834618 100755 --- a/music-player/Views/PlaylistDetailView.cs +++ b/music-player/Views/PlaylistDetailView.cs @@ -71,18 +71,18 @@ namespace MusicPlayer.Views List menuItemList = new List(); if (isTrackListEmpty == false) { - var share = new MenuItem("MenuItems") { Text = "Share" }; + var share = new MenuItem("MenuItems") { TranslatableText = "IDS_SHARE" }; share.Clicked += OnShareClick; menuItemList.Add(share); } if (viewModel.IsDefaultPlaylist == false) { - var add = new MenuItem("MenuItems") { Text = "Add" }; + var add = new MenuItem("MenuItems") { TranslatableText = "IDS_ADD" }; add.Clicked += OnAddClick; menuItemList.Add(add); if (isTrackListEmpty == false) { - var delete = new MenuItem("MenuItems") { Text = "Remove" }; + var delete = new MenuItem("MenuItems") { TranslatableText = "IDS_REMOVE" }; delete.Clicked += OnDeleteClick; menuItemList.Add(delete); } diff --git a/music-player/Views/PlaylistSelectorView.cs b/music-player/Views/PlaylistSelectorView.cs index c9b3dcc..609f107 100755 --- a/music-player/Views/PlaylistSelectorView.cs +++ b/music-player/Views/PlaylistSelectorView.cs @@ -64,7 +64,7 @@ namespace MusicPlayer.Views HorizontalAlignment = HorizontalAlignment.Begin, VerticalAlignment = VerticalAlignment.Top, }, - TitleContent = CreateAlertDialogTitle("Add to playlist"), + TitleContent = CreateAlertDialogTitle("IDS_ADD_TO_PLAYLIST"), Content = selectPlaylistContentArea, ActionContent = selectPlaylistActionArea, }; @@ -84,7 +84,7 @@ namespace MusicPlayer.Views PixelSize = 40.SpToPx(), FontFamily = "BreezeSans", FontStyle = UIFontStyles.AllNormal, - Text = titleText, + TranslatableText = titleText, WidthSpecification = LayoutParamPolicies.MatchParent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, @@ -290,7 +290,7 @@ namespace MusicPlayer.Views WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 108.SpToPx(), PixelSize = 32.SpToPx(), - Text = "No playlists available", + TranslatableText = "IDS_NO_PLAYLIST_AVAIL", HorizontalAlignment = HorizontalAlignment.Begin, VerticalAlignment = VerticalAlignment.Center, FontFamily = "BreezeSans", @@ -316,7 +316,7 @@ namespace MusicPlayer.Views selectPlaylistCancelButton = new Button() { Size2D = new Size2D(336, 96).SpToPx(), - Text = "Cancel", + TranslatableText = "IDS_CANCEL", PointSize = 16.SpToPx(), }; selectPlaylistActionArea.Add(selectPlaylistCancelButton); @@ -359,7 +359,7 @@ namespace MusicPlayer.Views WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 48.SpToPx(), PixelSize = 32.SpToPx(), - Text = "Add playlist name.", + TranslatableText = "IDS_ADD_PLAYLIST_NAME", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, FontFamily = "BreezeSans", @@ -382,7 +382,7 @@ namespace MusicPlayer.Views WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 36.SpToPx(), PixelSize = 24.SpToPx(), - Text = "Can't enter more than 64 characters.", + TranslatableText = "IDS_CANT_ENTER_MORE_CHAR", HorizontalAlignment = HorizontalAlignment.Begin, VerticalAlignment = VerticalAlignment.Center, FontFamily = "BreezeSans", @@ -453,7 +453,7 @@ namespace MusicPlayer.Views if (searchText.Length > 64) { ShowInfoMessage("Maximum number of characters reached"); - underText.Text = "Can't enter more than 64 characters."; + underText.TranslatableText = "IDS_CANT_ENTER_MORE_CHAR"; textField.Text = searchText.Substring(0, 63); } } @@ -486,7 +486,7 @@ namespace MusicPlayer.Views createPlaylistCreateButton = new Button() { Size2D = new Size2D(336, 96).SpToPx(), - Text = "Create", + TranslatableText = "IDS_CREATE", PointSize = 16.SpToPx(), }; createPlaylistCreateButton.TextLabel.FontStyle = UIFontStyles.AllNormal; @@ -525,7 +525,7 @@ namespace MusicPlayer.Views if (viewModel.CreatePlaylist(textField.Text) == false) { ShowInfoMessage("Playlist name already in use."); - underText.Text = "Playlist name already in use."; + underText.TranslatableText = "IDS_PLAYLIST_NAME_USED"; } } diff --git a/music-player/Views/PlaylistView.cs b/music-player/Views/PlaylistView.cs index d0688ba..2b96dfc 100755 --- a/music-player/Views/PlaylistView.cs +++ b/music-player/Views/PlaylistView.cs @@ -91,7 +91,7 @@ namespace MusicPlayer.Views protected override void UpdateContentMoreButtonItems(Menu moreMenu) { - var delete = new MenuItem("MenuItems"){ Text = "Delete", }; + var delete = new MenuItem("MenuItems"){ TranslatableText = "IDS_DELETE", }; delete.Clicked += OnDeleteClick; moreMenu.Items = new MenuItem[] { delete }; } @@ -124,7 +124,7 @@ namespace MusicPlayer.Views PixelSize = 40.SpToPx(), FontFamily = "BreezeSans", FontStyle = UIFontStyles.AllNormal, - Text = "Create playlist", + TranslatableText = "IDS_CREATE_PLAYLIST", WidthSpecification = LayoutParamPolicies.MatchParent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, @@ -142,7 +142,7 @@ namespace MusicPlayer.Views PixelSize = 32.SpToPx(), FontFamily = "BreezeSans", FontStyle = UIFontStyles.NormalLight, - Text = "Add playlist name", + TranslatableText = "IDS_ADD_PLAYLIST_NAME", WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 48.SpToPx(), HorizontalAlignment = HorizontalAlignment.Center, @@ -155,7 +155,7 @@ namespace MusicPlayer.Views TextField inputTextField = new TextField() { Name = "AlertDialogInputField", - PlaceholderText = "Enter Playlist Name", + TranslatablePlaceholderText = "IDS_ENTER_PLAYLIST_NAME", Text = DefaultPlaylistName, HorizontalAlignment = HorizontalAlignment.Begin, PixelSize = 32.SpToPx(), @@ -224,7 +224,7 @@ namespace MusicPlayer.Views { Size2D = new Size2D(336, 96).SpToPx(), Name = "AlertDialogCreateButton", - Text = "Create", + TranslatableText = "IDS_CREATE", PointSize = 16.SpToPx(), }; return createButton; diff --git a/music-player/Views/SearchView.cs b/music-player/Views/SearchView.cs index 0a4d999..ff9fe6d 100755 --- a/music-player/Views/SearchView.cs +++ b/music-player/Views/SearchView.cs @@ -104,7 +104,7 @@ namespace MusicPlayer.Views StyleName = "PageLabel", ThemeChangeSensitive = true, HeightSpecification = 48.SpToPx(), - Text = "Search", + TranslatableText = "IDS_SEARCH", PixelSize = 36.SpToPx(), FontFamily = "BreezeSans", Margin = new Extents(0, 32, 0, 0).SpToPx(), @@ -161,8 +161,8 @@ namespace MusicPlayer.Views HeightSpecification = 60.SpToPx(), BackgroundColor = Color.Transparent, PixelSize = 32.SpToPx(), - PlaceholderText = "Type Here", - PlaceholderTextFocused = "Search music", + TranslatablePlaceholderText = "IDS_TYPE_HERE", + TranslatablePlaceholderTextFocused = "IDS_SEARCH_MUSIC", HorizontalAlignment = HorizontalAlignment.Begin, VerticalAlignment = VerticalAlignment.Center, }; @@ -218,7 +218,7 @@ namespace MusicPlayer.Views { ListItemLayout layout = new ListItemLayout(); layout.Icon.SetBinding(ImageView.ResourceUrlProperty, "Thumbnail"); - layout.TitleLabel.SetBinding(TextLabel.TextProperty, "Title"); + layout.TitleLabel.SetBinding(TextLabel.TranslatableTextProperty, "Title"); layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "SubTitle"); return layout; }), @@ -320,7 +320,7 @@ namespace MusicPlayer.Views StyleName = "TitleText", WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 36.SpToPx(), - Text = "No results found", + TranslatableText = "IDS_NO_RESULT_FOUND", PixelSize = 24.SpToPx(), FontFamily = "BreezeSans", HorizontalAlignment = HorizontalAlignment.Center, diff --git a/music-player/Views/ViewManager.cs b/music-player/Views/ViewManager.cs index a17cf2b..c75df94 100755 --- a/music-player/Views/ViewManager.cs +++ b/music-player/Views/ViewManager.cs @@ -14,7 +14,7 @@ namespace MusicPlayer.Views { private readonly ViewLibrary viewLibrary; private View rootView; - private BaseView baseView; + private BaseView baseView; private static readonly string[] TabNames = new string[] { "Playlists", @@ -22,7 +22,6 @@ namespace MusicPlayer.Views "Albums", "Artists", }; - public ViewManager(Window win) { viewLibrary = new ViewLibrary(); @@ -86,7 +85,7 @@ namespace MusicPlayer.Views rootView = new View() { StyleName = "AppBackground", - Size = new Size(win.Size), + Size = new Size(win.Size), ThemeChangeSensitive = true, Layout = new FlexLayout() { @@ -114,7 +113,7 @@ namespace MusicPlayer.Views { baseView = new BaseView() { - Title = "Music", + Title = "IDS_MUSIC", MoreButton = true, SearchButton = true, }; diff --git a/music-player/music-player.csproj b/music-player/music-player.csproj index 24fcfbf..e1521bc 100755 --- a/music-player/music-player.csproj +++ b/music-player/music-player.csproj @@ -23,4 +23,19 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/music-player/res/themes/dark.xaml b/music-player/res/themes/dark.xaml index e97574c..aadc82b 100755 --- a/music-player/res/themes/dark.xaml +++ b/music-player/res/themes/dark.xaml @@ -182,7 +182,7 @@ Id="DarkTheme"> *Resource*/images/dark/cancel_button_bg.png - + diff --git a/music-player/res/themes/light.xaml b/music-player/res/themes/light.xaml index be03722..f4ef63c 100755 --- a/music-player/res/themes/light.xaml +++ b/music-player/res/themes/light.xaml @@ -182,7 +182,7 @@ Id="LightTheme"> *Resource*/images/light/cancel_button_bg.png - + diff --git a/packaging/org.tizen.MusicPlayer-1.0.0.tpk b/packaging/org.tizen.MusicPlayer-1.0.0.tpk index f40b0a8..246a10d 100755 Binary files a/packaging/org.tizen.MusicPlayer-1.0.0.tpk and b/packaging/org.tizen.MusicPlayer-1.0.0.tpk differ