OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 if (!languageMatchButNotLocale.length() && | 106 if (!languageMatchButNotLocale.length() && |
107 canonicalizedLanguageFromList.length() >= 3) { | 107 canonicalizedLanguageFromList.length() >= 3) { |
108 languageMatchButNotLocale = languageList[i]; | 108 languageMatchButNotLocale = languageList[i]; |
109 languageMatchButNotLocaleMatchIndex = i; | 109 languageMatchButNotLocaleMatchIndex = i; |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 // If we have both a language-only match and a languge-but-not-locale match, r
eturn the | 115 // If we have both a language-only match and a languge-but-not-locale match, |
116 // languge-only match as is considered a "better" match. For example, if the l
ist | 116 // return the languge-only match as is considered a "better" match. For |
117 // provided has both "en-GB" and "en" and the user prefers "en-US" we will ret
urn "en". | 117 // example, if the list provided has both "en-GB" and "en" and the user |
| 118 // prefers "en-US" we will return "en". |
118 if (languageWithoutLocaleMatch.length()) | 119 if (languageWithoutLocaleMatch.length()) |
119 return languageWithoutLocaleMatchIndex; | 120 return languageWithoutLocaleMatchIndex; |
120 | 121 |
121 if (languageMatchButNotLocale.length()) | 122 if (languageMatchButNotLocale.length()) |
122 return languageMatchButNotLocaleMatchIndex; | 123 return languageMatchButNotLocaleMatchIndex; |
123 | 124 |
124 return languageList.size(); | 125 return languageList.size(); |
125 } | 126 } |
126 | 127 |
127 } // namespace blink | 128 } // namespace blink |
OLD | NEW |