From c25189df16b7006928ca22f4e4f27c37510ca33c Mon Sep 17 00:00:00 2001 From: Lukasz Stanislawski Date: Tue, 14 Apr 2020 15:06:26 +0200 Subject: [PATCH] clean up Language and Region resources The previous language and regions xml resources were copied from old oobe implementation. Some of xml attributes used there are not used anymore in new oobe and in some cases - like setting city and timezone depending on country codes - it doesn't make sense to set them. --- Oobe/Oobe.Language/Model/LanguageInfo.cs | 6 +----- Oobe/Oobe.Language/res/languages_OOBE.xml | 6 +++--- Oobe/Oobe.Region/Model/RegionInfo.cs | 9 +-------- Oobe/Oobe.Region/Model/RegionManager.cs | 14 +------------- Oobe/Oobe.Region/RegionStep.cs | 2 +- Oobe/Oobe.Region/res/regions_OOBE.xml | 6 +++--- README.md | 25 +++++++++++++++++++++++++ 7 files changed, 35 insertions(+), 33 deletions(-) diff --git a/Oobe/Oobe.Language/Model/LanguageInfo.cs b/Oobe/Oobe.Language/Model/LanguageInfo.cs index 4b18eb3..4f6ce4b 100644 --- a/Oobe/Oobe.Language/Model/LanguageInfo.cs +++ b/Oobe/Oobe.Language/Model/LanguageInfo.cs @@ -6,11 +6,7 @@ namespace Oobe.Language.Model { [XmlAttribute("code")] public string Code { get; set; } - [XmlAttribute("name_en")] - public string EnglishName { get; set; } [XmlAttribute("name_local")] public string LocalName { get; set; } - [XmlAttribute("message")] - public string Message { get; set; } } -} \ No newline at end of file +} diff --git a/Oobe/Oobe.Language/res/languages_OOBE.xml b/Oobe/Oobe.Language/res/languages_OOBE.xml index 1c8602a..a09487f 100644 --- a/Oobe/Oobe.Language/res/languages_OOBE.xml +++ b/Oobe/Oobe.Language/res/languages_OOBE.xml @@ -1,6 +1,6 @@ - - - + + + diff --git a/Oobe/Oobe.Region/Model/RegionInfo.cs b/Oobe/Oobe.Region/Model/RegionInfo.cs index 692406e..6fa8df1 100644 --- a/Oobe/Oobe.Region/Model/RegionInfo.cs +++ b/Oobe/Oobe.Region/Model/RegionInfo.cs @@ -6,14 +6,7 @@ namespace Oobe.Region.Model { [XmlAttribute("code")] public string CountryCode { get; set; } - [XmlAttribute("name")] + [XmlAttribute("name_en")] public string Name { get; set; } - [XmlAttribute("timezone")] - public string Timezone{ get; set; } - [XmlAttribute("cityname")] - public string CityName { get; set; } - [XmlAttribute("id")] - public string Id { get; set; } - } } diff --git a/Oobe/Oobe.Region/Model/RegionManager.cs b/Oobe/Oobe.Region/Model/RegionManager.cs index 101988c..e66197e 100644 --- a/Oobe/Oobe.Region/Model/RegionManager.cs +++ b/Oobe/Oobe.Region/Model/RegionManager.cs @@ -10,9 +10,6 @@ namespace Oobe.Region.Model { public class RegionManager { - private const string CountryCodeVconfKey = "db/setting/country_code"; - private const string CityNameIdVconfKey = "db/setting/cityname_id"; - public RegionManager() { var filename = Tizen.Applications.CoreApplication.Current.DirectoryInfo.Resource + "regions_OOBE.xml"; @@ -31,22 +28,13 @@ namespace Oobe.Region.Model { get { - return Regions.Single(s => s.Timezone == Vconf.GetString(CountryCodeVconfKey)); + return Regions.Single(s => s.CountryCode == SystemSettings.LocaleCountry); } set { if (value != null) { - SystemSettings.LocaleTimeZone = value.Timezone; SystemSettings.LocaleCountry = value.CountryCode; - try { - Vconf.SetString(CountryCodeVconfKey, value.CountryCode); - Vconf.SetString(CityNameIdVconfKey, value.CityName); - } - catch (Exception e) - { - Tizen.Log.Debug("oobe", $"setting vconf keys failed: {e.Message}"); - } } } } diff --git a/Oobe/Oobe.Region/RegionStep.cs b/Oobe/Oobe.Region/RegionStep.cs index 5da3a38..474ac2c 100644 --- a/Oobe/Oobe.Region/RegionStep.cs +++ b/Oobe/Oobe.Region/RegionStep.cs @@ -43,7 +43,7 @@ namespace Oobe.Region foreach (RegionInfo info in manager.Regions) { CarouselPickerItemData item = new CarouselPickerItemData(); - item.TranslatableText = info.Id; + item.TranslatableText = info.Name; carousel.AddItem(item); } diff --git a/Oobe/Oobe.Region/res/regions_OOBE.xml b/Oobe/Oobe.Region/res/regions_OOBE.xml index 9e66ab5..66ca932 100644 --- a/Oobe/Oobe.Region/res/regions_OOBE.xml +++ b/Oobe/Oobe.Region/res/regions_OOBE.xml @@ -1,6 +1,6 @@ - - - + + + diff --git a/README.md b/README.md index c6beb0b..10dfbe5 100644 --- a/README.md +++ b/README.md @@ -1 +1,26 @@ # OOBE + +## Adding new languages +The language list is loaded from xml file placed in +Oobe/Oobe.Language/res/languages_OOBE.xml + +To add new language add an xml node +``` + +``` +Where: +"code" - follows the _ syntax. The language setting is in the ISO 639-2 format and the region setting is in the ISO 3166-1 alpha-2 format +"name_local" - language native name + +## Adding new regions +The country list is loaded from xml file placed in +Oobe/Oobe.Region/res/regions_OOBE.xml + +To add new language add an xml node +``` + +``` +Where: +"code" - follows the _ syntax. The language setting is in the ISO 639-2 format and the region setting is in the ISO 3166-1 alpha-2 format +"name_en" - the english name of item. It will be used as key for translations +defined in Oobe/Oobe.Common/Resources/Translations.resx -- 2.7.4