--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Tizen.System;
+using Tizen.Applications;
+
+namespace Oobe.Common.Services
+{
+ public static class Settings
+ {
+ private const string CountryCodeKey = "country_code";
+
+ /// <summary>
+ /// Current device language
+ /// in <LANGUAGE>_<REGION> syntax. The country setting is in the ISO 639-2 format, and the region setting is in the ISO 3166-1 alpha-2 format
+ /// </summary>
+ public static string Language
+ {
+ get
+ {
+ return SystemSettings.LocaleLanguage;
+ }
+
+ set
+ {
+ SystemSettings.LocaleLanguage = value;
+ SystemSettings.LocaleCountry = value;
+ }
+ }
+
+ /// <summary>
+ /// Country code in ISO 3166-1 alpha-2.
+ /// </summary>
+ public static string Country
+ {
+ get
+ {
+ if (Preference.Contains(CountryCodeKey))
+ {
+ return Preference.Get<string>(CountryCodeKey);
+ }
+ return String.Empty;
+ }
+
+ set
+ {
+ Preference.Set(CountryCodeKey, value);
+ }
+ }
+ }
+}
*/
using System.Collections.Generic;
-using Tizen.System;
using System.Linq;
using System.IO;
using System.Xml.Serialization;
+using Oobe.Common.Services;
namespace Oobe.Language.Model
{
{
get
{
- return Languages.FirstOrDefault(s => s.Code == SystemSettings.LocaleLanguage) ?? Languages.FirstOrDefault();
+ return Languages.FirstOrDefault(s => s.Code == Settings.Language) ?? Languages.FirstOrDefault();
}
set
{
if (value != null)
{
- SystemSettings.LocaleLanguage = value.Code;
+ Settings.Language = value.Code;
}
}
}
using System.IO;
using System.Linq;
using System.Xml.Serialization;
-using Tizen.System;
using Oobe.Common.Services;
using System;
{
get
{
- return Regions.FirstOrDefault(s => s.CountryCode == SystemSettings.LocaleCountry) ?? Regions.FirstOrDefault();
+ return Regions.FirstOrDefault(s => s.CountryCode == Settings.Country) ?? Regions.FirstOrDefault();
}
set
{
if (value != null)
{
- SystemSettings.LocaleCountry = value.CountryCode;
+ Settings.Country = value.CountryCode;
}
}
}
using System;
using System.IO;
-using Tizen.System;
+using Oobe.Common.Services;
namespace Oobe.Terms.Model
{
public string LoadTerms()
{
string terms = null;
- var locale = SystemSettings.LocaleCountry;
+ var locale = Settings.Country;
var filename = Path.Combine(Tizen.Applications.CoreApplication.Current.DirectoryInfo.Resource , "terms" , locale + ".txt");
try {