// See the License for the specific language governing permissions and
// limitations under the License.
//
+
#include <errno.h>
+#include <new>
+#include <unique_ptr.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <account.h>
#include <account-types.h>
#include <FBaseDataType.h>
+#include <FBaseString.h>
#include <FBaseSysLog.h>
+#include <FBaseUtilStringTokenizer.h>
+#include <FBaseUtilStringUtil.h>
#define _SysTryReturn(NID, condition, returnValue, ...) \
if (!(condition)) { \
} \
else {;}
+using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
static const xmlChar _NODE_ACCOUNT_PROVIDER[] = "account-provider";
static const xmlChar _NODE_ICON[] = "icon";
{
SysLog(NID_SCL, "Attribute: xml:lang - %s", pLang);
+ String lang(reinterpret_cast<char*> (pLang));
+
+ StringTokenizer strTok(lang, L"-");
+ String token;
+ String convertedLang;
+
+ strTok.GetNextToken(convertedLang);
+ convertedLang.Append(L"_");
+
+ strTok.GetNextToken(token);
+ token.ToUpper();
+ convertedLang.Append(token);
+
+ std::unique_ptr<ByteBuffer> pConvertedLangBuf(StringUtil::StringToUtf8N(convertedLang));
+ _SysTryCatch(NID_SCL, pConvertedLangBuf != null, ret = -1, "Failed to convert String to Utf8N.");
+
+ SysLog(NID_SCL, "Attribute: converted lang - %s", pConvertedLangBuf->GetPointer());
+
xmlChar* pLabel = xmlNodeListGetString(docPtr, curPtr->xmlChildrenNode, 1);
_SysTryCatch(NID_SCL, pLabel != null, ret = -EINVAL, "Failed to get the value.");
SysLog(NID_SCL, "Node: label - %s", pLabel);
- ret = account_type_set_label(accountTypeHandle, reinterpret_cast<char*> (pLabel), reinterpret_cast<char*> (pLang));
+ ret = account_type_set_label(accountTypeHandle, reinterpret_cast<char*> (pLabel), reinterpret_cast<char*> (pConvertedLangBuf->GetPointer()));
_SysTryCatch(NID_SCL, ret == ACCOUNT_ERROR_NONE, ret = -1, "Failed to set the display name.");
}
}
namespace Tizen { namespace Social
{
+static const wchar_t* _DEFAULT_LOCALE = L"en_GB";
+
bool
OnAccountTypeLabelReceived(char* pAppId, char* pLabel, char* pLocale, void* pUserData)
{
String localeStr(Locale::LanguageCodeToTwoLetterLanguageCodeString(languageCode));
String countryCodeStr(systemLocale.GetCountryCodeString());
- countryCodeStr.ToLowerCase();
- localeStr.Append(L"-");
+ localeStr.Append(L"_");
localeStr.Append(countryCodeStr);
- String engGbCode(L"en-gb");
String* pDisplayName = static_cast<String*> (pUserData);
if (localeStr.Equals(String(pLocale)))
{
*pDisplayName = String(pLabel);
}
- else if(engGbCode.Equals(String(pLocale)) && pDisplayName->IsEmpty())
+ else if((String(_DEFAULT_LOCALE)).Equals(String(pLocale)) && pDisplayName->IsEmpty())
{
*pDisplayName = String(pLabel);
}