mirror of
https://gitee.com/openharmony/global_i18n
synced 2024-11-23 07:00:13 +00:00
记录升级locale
Signed-off-by: LY <liuyong235@huawei.com>
This commit is contained in:
parent
e75d9689f2
commit
12a7538e8e
@ -15,6 +15,7 @@ persist.global.locale=
|
||||
persist.global.is24Hour=default
|
||||
persist.global.preferredLanguages=
|
||||
persist.global.tz_override=false
|
||||
persist.global.upgrade_locale=
|
||||
const.global.language=zh-Hans
|
||||
const.global.locale=zh-Hans-CN
|
||||
const.global.region=CN
|
@ -16,6 +16,7 @@ persist.global.locale = i18n:i18n:0775
|
||||
persist.global.is24Hour = i18n:i18n:0775
|
||||
persist.global.preferredLanguages = i18n:i18n:0775
|
||||
persist.global.tz_override = i18n:i18n:0775
|
||||
persist.global.upgrade_locale = i18n:i18n:0775
|
||||
const.global.locale = i18n:i18n:0444
|
||||
const.global.language = i18n:i18n:0444
|
||||
const.global.region = i18n:i18n:0444
|
@ -120,6 +120,7 @@ private:
|
||||
static const char *LANGUAGE_KEY;
|
||||
static const char *LOCALE_KEY;
|
||||
static const char *HOUR_KEY;
|
||||
static const char *UPGRADE_LOCALE_KEY;
|
||||
static const char *DEFAULT_LOCALE_KEY;
|
||||
static const char *DEFAULT_LANGUAGE_KEY;
|
||||
static const char *DEFAULT_REGION_KEY;
|
||||
@ -179,6 +180,7 @@ private:
|
||||
static void SetLocale2DisplayName(const char* key, const char* value);
|
||||
static bool Is24HourLocale(const std::string& systemLocale);
|
||||
static bool HasDesignator(const std::string& inFormat, const char designator);
|
||||
static void QueryUpgradeLocale();
|
||||
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
/**
|
||||
|
@ -53,6 +53,7 @@ using namespace std;
|
||||
const char *LocaleConfig::LANGUAGE_KEY = "persist.global.language";
|
||||
const char *LocaleConfig::LOCALE_KEY = "persist.global.locale";
|
||||
const char *LocaleConfig::HOUR_KEY = "persist.global.is24Hour";
|
||||
const char *LocaleConfig::UPGRADE_LOCALE_KEY = "persist.global.upgrade_locale";
|
||||
const char *LocaleConfig::DEFAULT_LOCALE_KEY = "const.global.locale";
|
||||
const char *LocaleConfig::DEFAULT_LANGUAGE_KEY = "const.global.language";
|
||||
const char *LocaleConfig::DEFAULT_REGION_KEY = "const.global.region";
|
||||
@ -1223,6 +1224,7 @@ I18nErrorCode LocaleConfig::SetSystemLanguage(const std::string &languageTag)
|
||||
|
||||
I18nErrorCode LocaleConfig::SetSystemRegion(const std::string ®ionTag)
|
||||
{
|
||||
QueryUpgradeLocale();
|
||||
if (!IsValidRegion(regionTag)) {
|
||||
HILOG_ERROR_I18N("LocaleConfig::SetSystemRegion %{public}s is not valid region tag.", regionTag.c_str());
|
||||
return I18nErrorCode::INVALID_REGION_TAG;
|
||||
@ -1232,6 +1234,14 @@ I18nErrorCode LocaleConfig::SetSystemRegion(const std::string ®ionTag)
|
||||
return SetSystemLocale(UpdateRegionOfLocale(regionTag));
|
||||
}
|
||||
|
||||
void LocaleConfig::QueryUpgradeLocale()
|
||||
{
|
||||
std::string upgradeLocale = ReadSystemParameter(UPGRADE_LOCALE_KEY, CONFIG_LEN);
|
||||
if (!upgradeLocale.empty()) {
|
||||
HILOG_ERROR_I18N("LocaleConfig::QueryUpgradeLocale: upgrade locale is %{public}s.", upgradeLocale.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
I18nErrorCode LocaleConfig::SetSystemLocale(const std::string &localeTag)
|
||||
{
|
||||
if (!IsValidTag(localeTag)) {
|
||||
|
Loading…
Reference in New Issue
Block a user