File tree 2 files changed +13
-2
lines changed 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ var Gmail = function(localJQuery) {
183
183
184
184
api . helper . get . locale_from_url_params = function ( value ) {
185
185
// check if is URL
186
- if ( value && value . indexOf && value . indexOf ( "https://" ) === 0 ) {
186
+ if ( value && value . indexOf && ( value . indexOf ( "https://" ) === 0 || value . indexOf ( "http://" ) === 0 ) ) {
187
187
var urlParts = value . split ( "?" ) ;
188
188
if ( urlParts . length > 1 ) {
189
189
var hash = urlParts [ 1 ] ;
@@ -225,7 +225,16 @@ var Gmail = function(localJQuery) {
225
225
// has historically been observed as [7], [8] and [9]!
226
226
var localeList = api . helper . get . array_sublist ( globals [ 17 ] , "ui" ) ;
227
227
if ( localeList !== null && localeList . length > 8 ) {
228
- var locale = api . helper . get . locale_from_globals_item ( localeList ) ;
228
+ let locale = api . helper . get . locale_from_globals_item ( localeList ) ;
229
+ locale = api . helper . filter_locale ( locale ) ;
230
+ if ( locale ) {
231
+ return locale ;
232
+ }
233
+ }
234
+
235
+ // in new gmail, globals[12] may contain a link to an help-article, with a hl= language-code
236
+ if ( globals [ 12 ] !== null ) {
237
+ let locale = api . helper . get . locale_from_url_params ( globals [ 12 ] ) ;
229
238
locale = api . helper . filter_locale ( locale ) ;
230
239
if ( locale ) {
231
240
return locale ;
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ describe("Locale URL-parsing", () => {
51
51
testCase ( "https://account.google.com/user/stats?hl=en" , "en" ) ;
52
52
testCase ( "https://account.google.com/user/stats?firstParam=value&hl=en" , "en" ) ;
53
53
testCase ( "https://account.google.com/user/stats?foo=bar&hl=no&someMoreStuff" , "no" ) ;
54
+ testCase ( "http://www.google.com/support/a/cedpta.com/bin/topic.py?topic=10100&hl=en" , "en" ) ;
55
+ testCase ( "http://support.google.com/?ctx=%67mail&hl=no" , "no" ) ;
54
56
} ) ;
55
57
} ) ;
56
58
You can’t perform that action at this time.
0 commit comments