2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file localization_utils.h
18 * @author Bartosz Janiak (b.janiak@samsung.com)
22 #ifndef LOCALIZATION_UTILS_H
23 #define LOCALIZATION_UTILS_H
27 #include <dpl/log/log.h>
28 #include <dpl/optional.h>
29 #include <dpl/read_write_mutex.h>
30 #include <dpl/string.h>
34 * Structure to hold information about widget icon.
40 width(DPL::Optional<int>::Null),
41 height(DPL::Optional<int>::Null)
46 * a valid URI to an image file inside the widget package that represents an
47 * iconic representation of the widget
50 DPL::Optional<int> width; /// the width of the icon in pixels
51 DPL::Optional<int> height; /// the height of the icon in pixels
53 bool operator==(const WidgetIcon &other) const
55 return src == other.src;
59 struct WidgetStartFileInfo
62 DPL::String localizedPath;
66 bool operator==(const WidgetStartFileInfo& other) const
68 return file == other.file &&
69 localizedPath == other.localizedPath &&
70 encoding == other.encoding &&
75 typedef DPL::Optional<WidgetIcon> OptionalWidgetIcon;
76 typedef std::list<DPL::String> LanguageTagsList;
77 typedef DPL::Optional<WidgetStartFileInfo> OptionalWidgetStartFileInfo;
79 namespace LocalizationUtils {
80 DPL::String BCP47LanguageTagToLocale(const DPL::String&);
81 DPL::String LocaleToBCP47LanguageTag(const DPL::String&);
83 void SetUserLanguageTags(const LanguageTagsList& tags);
84 void SetSystemLanguageTags(const LanguageTagsList& tags);
85 LanguageTagsList GetUserAgentLanguageTags();
90 #endif //LOCALIZATION_UTILS_H