| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/i18n/rtl.h" | 5 #include "base/i18n/rtl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 std::string result = | 26 std::string result = |
| 27 (language != NULL && *language != '\0') ? language : "und"; | 27 (language != NULL && *language != '\0') ? language : "und"; |
| 28 | 28 |
| 29 if (country != NULL && *country != '\0') { | 29 if (country != NULL && *country != '\0') { |
| 30 result += '-'; | 30 result += '-'; |
| 31 result += country; | 31 result += country; |
| 32 } | 32 } |
| 33 | 33 |
| 34 if (variant != NULL && *variant != '\0') { | 34 if (variant != NULL && *variant != '\0') { |
| 35 std::string variant_str(variant); | 35 std::string variant_str(variant); |
| 36 StringToLowerASCII(&variant_str); | 36 base::StringToLowerASCII(&variant_str); |
| 37 result += '@' + variant_str; | 37 result += '@' + variant_str; |
| 38 } | 38 } |
| 39 | 39 |
| 40 return result; | 40 return result; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // Returns LEFT_TO_RIGHT or RIGHT_TO_LEFT if |character| has strong | 43 // Returns LEFT_TO_RIGHT or RIGHT_TO_LEFT if |character| has strong |
| 44 // directionality, returns UNKNOWN_DIRECTION if it doesn't. Please refer to | 44 // directionality, returns UNKNOWN_DIRECTION if it doesn't. Please refer to |
| 45 // http://unicode.org/reports/tr9/ for more information. | 45 // http://unicode.org/reports/tr9/ for more information. |
| 46 base::i18n::TextDirection GetCharacterDirection(UChar32 character) { | 46 base::i18n::TextDirection GetCharacterDirection(UChar32 character) { |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 begin == kRightToLeftOverride) | 385 begin == kRightToLeftOverride) |
| 386 ++begin_index; | 386 ++begin_index; |
| 387 size_t end_index = text.length() - 1; | 387 size_t end_index = text.length() - 1; |
| 388 if (text[end_index] == kPopDirectionalFormatting) | 388 if (text[end_index] == kPopDirectionalFormatting) |
| 389 --end_index; | 389 --end_index; |
| 390 return text.substr(begin_index, end_index - begin_index + 1); | 390 return text.substr(begin_index, end_index - begin_index + 1); |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace i18n | 393 } // namespace i18n |
| 394 } // namespace base | 394 } // namespace base |
| OLD | NEW |