Google: Fix Language.normalize to not prepend the empty string with 'lang_'

This commit is contained in:
James Vega 2009-01-28 21:22:34 +00:00
parent 10342acd11
commit 125d542706

View File

@ -54,7 +54,7 @@ class Language(registry.OnlySomeStrings):
'tr'.split()] 'tr'.split()]
validStrings.append('') validStrings.append('')
def normalize(self, s): def normalize(self, s):
if not s.startswith('lang_'): if s and not s.startswith('lang_'):
s = 'lang_' + s s = 'lang_' + s
if not s.endswith('CN') or s.endswith('TW'): if not s.endswith('CN') or s.endswith('TW'):
s = s.lower() s = s.lower()