clean up Language and Region resources
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Tue, 14 Apr 2020 13:06:26 +0000 (15:06 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Tue, 14 Apr 2020 13:15:00 +0000 (15:15 +0200)
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
Oobe/Oobe.Language/res/languages_OOBE.xml
Oobe/Oobe.Region/Model/RegionInfo.cs
Oobe/Oobe.Region/Model/RegionManager.cs
Oobe/Oobe.Region/RegionStep.cs
Oobe/Oobe.Region/res/regions_OOBE.xml
README.md

index 4b18eb3..4f6ce4b 100644 (file)
@@ -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
+}
index 1c8602a..a09487f 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <languages>
-  <language code="ko_KR" name_en="Korean" name_local="한국어" message="언어 선택" />
-  <language code="en_US" name_en="English (US)" name_local="English" message="Select your language" />
-  <language code="pl_PL" name_en="Polish" name_local="Polski" message="Wybierz swój język" />
+  <language code="ko_KR" name_local="한국어" />
+  <language code="en_US" name_local="English" />
+  <language code="pl_PL" name_local="Polski" />
 </languages>
index 692406e..6fa8df1 100644 (file)
@@ -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; }
-        
     }
 }
index 101988c..e66197e 100644 (file)
@@ -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}");
-                    }
                 }
             }
         }
index 5da3a38..474ac2c 100644 (file)
@@ -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);
             }
 
index 9e66ab5..66ca932 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <regions>
-  <region code="en_GB" name="United Kingdom" timezone="Europe/London" id="UNITED_KINGDOM" />
-  <region code="ko_KR" name="South Korea" timezone="Asia/Seoul" id="SOUTH_KOREA" />
-  <region code="pl_PL" name="Poland" timezone="Europe/Warsaw" id="POLAND" />
+  <region code="en_GB" name_en="UNITED_KINGDOM" />
+  <region code="ko_KR" name_en="SOUTH_KOREA" />
+  <region code="pl_PL" name_en="POLAND" />
 </regions>
index c6beb0b..10dfbe5 100644 (file)
--- 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
+```
+  <language code="pl_PL" name_local="Polski" />
+```
+Where:
+"code" - follows the <LANGUAGE>_<REGION> 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
+```
+  <region code="pl_PL" name_en="POLAND" />
+```
+Where:
+"code" - follows the <LANGUAGE>_<REGION> 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