version 1.23, 2006/01/10 19:41:15
|
version 1.25, 2006/01/30 16:17:04
|
|
|
//%2005//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; | // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// EMC Corporation; VERITAS Software Corporation; The Open Group. | // EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
static char LANGUAGE_TAG_SEPARATOR_CHAR = '-'; | static char LANGUAGE_TAG_SEPARATOR_CHAR = '-'; |
static char LOCALE_ID_SEPARATOR_CHAR = '_'; |
|
| |
AcceptLanguageList LanguageParser::parseAcceptLanguageHeader( | AcceptLanguageList LanguageParser::parseAcceptLanguageHeader( |
const String& acceptLanguageHeader) | const String& acceptLanguageHeader) |
|
|
} | } |
| |
void LanguageParser::parseLanguageTag( | void LanguageParser::parseLanguageTag( |
const String& languageTagString_, |
const String& languageTagString, |
String& language, | String& language, |
String& country, | String& country, |
String& variant) | String& variant) |
{ | { |
PEG_METHOD_ENTER(TRC_L10N, "LanguageParser::parseLanguageTag"); | PEG_METHOD_ENTER(TRC_L10N, "LanguageParser::parseLanguageTag"); |
| |
// Convert locale ID format to language tag format |
|
String languageTagString = languageTagString_; |
|
Uint32 index = 0; |
|
while ((index = languageTagString.find(index, LOCALE_ID_SEPARATOR_CHAR)) != |
|
PEG_NOT_FOUND) |
|
{ |
|
languageTagString[index] = LANGUAGE_TAG_SEPARATOR_CHAR; |
|
} |
|
|
|
language.clear(); | language.clear(); |
country.clear(); | country.clear(); |
variant.clear(); | variant.clear(); |