add isRTL innerkits to i18n

Signed-off-by: sunyaozu <sunyaozu@huawei.com>
This commit is contained in:
sunyaozu 2021-11-15 11:56:47 +08:00
parent ddfe623fb0
commit 576474f1fe

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2021 Huawei Device 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.
*/
#ifndef I18N_STANDARD_ISRTL_LOCALE_UTIL_H
#define I18N_STANDARD_ISRTL_LOCALE_UTIL_H
#include <string>
#include "locid.h"
namespace OHOS {
namespace Global {
namespace I18n {
static inline bool IsRTL(const std::string &locale)
{
icu::Locale curLocale(locale.c_str());
return curLocale.isRightToLeft();
}
}
}
}
#endif