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
16 #include "taboo_utils.h"
17
18 namespace OHOS {
19 namespace Global {
20 namespace I18n {
TabooUtils()21 TabooUtils::TabooUtils()
22 {
23 systemTaboo = std::make_shared<Taboo>(systemTabooDataPath);
24 }
25
~TabooUtils()26 TabooUtils::~TabooUtils()
27 {
28 }
29
ReplaceCountryName(const std::string & region,const std::string & displayLanguage,const std::string & name)30 std::string TabooUtils::ReplaceCountryName(const std::string& region, const std::string& displayLanguage,
31 const std::string& name)
32 {
33 std::shared_ptr<Taboo> taboo = GetLatestTaboo();
34 return taboo->ReplaceCountryName(region, displayLanguage, name);
35 }
36
ReplaceLanguageName(const std::string & language,const std::string & displayLanguage,const std::string & name)37 std::string TabooUtils::ReplaceLanguageName(const std::string& language, const std::string& displayLanguage,
38 const std::string& name)
39 {
40 std::shared_ptr<Taboo> taboo = GetLatestTaboo();
41 return taboo->ReplaceLanguageName(language, displayLanguage, name);
42 }
43
GetLatestTaboo()44 std::shared_ptr<Taboo> TabooUtils::GetLatestTaboo()
45 {
46 return systemTaboo;
47 }
48 } // namespace I18n
49 } // namespace Global
50 } // namespace OHOS