Mercurial > babel > old > babel-test
comparison babel/core.py @ 535:2cfe20fd80a0 stable-0.9.x
merge r586 from trunk
author | fschwarz |
---|---|
date | Fri, 11 Mar 2011 16:25:08 +0000 |
parents | 8da9e83f6df8 |
children |
comparison
equal
deleted
inserted
replaced
524:4a5340c0821b | 535:2cfe20fd80a0 |
---|---|
640 locale = locale.split(':')[0] | 640 locale = locale.split(':')[0] |
641 if locale in ('C', 'POSIX'): | 641 if locale in ('C', 'POSIX'): |
642 locale = 'en_US_POSIX' | 642 locale = 'en_US_POSIX' |
643 elif aliases and locale in aliases: | 643 elif aliases and locale in aliases: |
644 locale = aliases[locale] | 644 locale = aliases[locale] |
645 return '_'.join(filter(None, parse_locale(locale))) | 645 try: |
646 return '_'.join(filter(None, parse_locale(locale))) | |
647 except ValueError: | |
648 pass | |
646 | 649 |
647 def negotiate_locale(preferred, available, sep='_', aliases=LOCALE_ALIASES): | 650 def negotiate_locale(preferred, available, sep='_', aliases=LOCALE_ALIASES): |
648 """Find the best match between available and requested locale strings. | 651 """Find the best match between available and requested locale strings. |
649 | 652 |
650 >>> negotiate_locale(['de_DE', 'en_US'], ['de_DE', 'de_AT']) | 653 >>> negotiate_locale(['de_DE', 'en_US'], ['de_DE', 'de_AT']) |