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 view_logic_custom_header_support.cpp
18 * @author Jihoon Chung (jihoon.chung@samsung.com)
19 * @brief Implementation file of CustomHeaderSupport API used by ViewLogic
22 #include "view_logic_custom_header_support.h"
25 #include <vconf-keys.h>
28 #include <dpl/log/log.h>
31 const std::string LANGUAGE_EN = "en";
34 namespace ViewModule {
35 namespace CustomHeaderSupport {
36 std::string getValueByField(const std::string field)
38 LogDebug("Field : " << field);
41 if (field == ACCEPT_LANGUAGE) {
42 char *systemLanguageSet = NULL;
43 systemLanguageSet = vconf_get_str(VCONFKEY_LANGSET);
44 LogDebug("system language = [" << systemLanguageSet << "]");
46 if (!systemLanguageSet) {
47 LogError("Failed to get VCONFKEY_LANGSET. set as English");
48 ret.append(LANGUAGE_EN);
50 // copy first 2bytes of language set (en, ko, po)
51 ret.append(systemLanguageSet, 2);
54 if (systemLanguageSet) {
55 free(systemLanguageSet);
58 LogError("Wrong field is passed");
64 } // namespace CustomHeaderSupport
65 } // namespace ViewModule