• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef OHOS_GLOBAL_I18N_LOCALE_COMPARE_H
16 #define OHOS_GLOBAL_I18N_LOCALE_COMPARE_H
17 
18 #include <map>
19 #include <set>
20 #include <string>
21 
22 namespace OHOS {
23 namespace Global {
24 namespace I18n {
25 class LocaleCompare {
26 public:
27     static int32_t Compare(const std::string& localeTag1, const std::string& localeTag2);
28 
29 private:
30     static bool IsSameLanguage(const std::string& langTag1, const std::string& langTag2);
31     static bool IsSameEnglishScript(const std::string& scriptTag1, const std::string& scriptTag2);
32     static bool HasMapRelation(const std::string& languageTag, const std::string& localeTag1,
33         const std::string& localeTag2);
34     static std::string hantSegment;
35     static std::string latnSegment;
36     static std::string qaagSegment;
37     static std::set<std::string> scriptLocales;
38     static std::map<std::string, std::string> hantParent;
39     static std::map<std::string, std::string> latnParent;
40     static std::map<std::string, std::string> extendedHantParent;
41     static std::map<std::string, std::string> extendedLatnParent;
42 };
43 } // namespace I18n
44 } // namespace Global
45 } // namespace OHOS
46 #endif