You could also check that the preceding character is '?' or '&'. I'm not sure in this context if it can actually be at pos 0 or not.
On Thu, Feb 5, 2009 at 7:55 PM, <zun...@google.com> wrote: > > Reviewers: jat, > > Description: > Tighten up query string parsing for "locale" value in I18N.gwt.xml. > Potentially, another string might have the substring "locale" embedded > somehow. This is just a minor improvement and doesn't handle every case. > > Please review this at http://gwt-code-reviews.appspot.com/2802 > > Affected files: > user/src/com/google/gwt/i18n/I18N.gwt.xml > > > Index: user/src/com/google/gwt/i18n/I18N.gwt.xml > =================================================================== > --- user/src/com/google/gwt/i18n/I18N.gwt.xml (revision 4644) > +++ user/src/com/google/gwt/i18n/I18N.gwt.xml (working copy) > @@ -27,7 +27,7 @@ > // Look for the locale as a url argument > if (locale == null) { > var args = location.search; > - var startLang = args.indexOf("locale"); > + var startLang = args.indexOf("locale="); > if (startLang >= 0) { > var language = args.substring(startLang); > var begin = language.indexOf("=") + 1; > > > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---