Update language names to match Google Translate (#33)

* Change language names to match Google Translate

This commit also fixes an issue introduced by commit 04a0e6df (issue #26),
where language names with underscores in them would not work, because
everything after an underscore is ignored.

* Add test for language names with spaces in them
This commit is contained in:
Encrylize 2017-08-09 13:58:08 +02:00 committed by ssut
parent 4e52393ceb
commit 066eff6293
2 changed files with 11 additions and 6 deletions

View File

@ -19,8 +19,8 @@ LANGUAGES = {
'ca': 'catalan',
'ceb': 'cebuano',
'ny': 'chichewa',
'zh-CN': 'chinese_simplified',
'zh-TW': 'chinese_traditional',
'zh-cn': 'chinese (simplified)',
'zh-tw': 'chinese (traditional)',
'co': 'corsican',
'hr': 'croatian',
'cs': 'czech',
@ -38,7 +38,7 @@ LANGUAGES = {
'de': 'german',
'el': 'greek',
'gu': 'gujarati',
'ht': 'haitian_creole',
'ht': 'haitian creole',
'ha': 'hausa',
'haw': 'hawaiian',
'iw': 'hebrew',
@ -56,7 +56,7 @@ LANGUAGES = {
'kk': 'kazakh',
'km': 'khmer',
'ko': 'korean',
'ku': 'kurdish',
'ku': 'kurdish (kurmanji)',
'ky': 'kyrgyz',
'lo': 'lao',
'la': 'latin',
@ -71,7 +71,7 @@ LANGUAGES = {
'mi': 'maori',
'mr': 'marathi',
'mn': 'mongolian',
'my': 'myanmar',
'my': 'myanmar (burmese)',
'ne': 'nepali',
'no': 'norwegian',
'ps': 'pashto',
@ -82,7 +82,7 @@ LANGUAGES = {
'ro': 'romanian',
'ru': 'russian',
'sm': 'samoan',
'gd': 'scots_gaelic',
'gd': 'scots gaelic',
'sr': 'serbian',
'st': 'sesotho',
'sn': 'shona',

View File

@ -42,6 +42,11 @@ def test_language_name(translator):
assert result.text == u'Dia dhuit'
def test_language_name_with_space(translator):
result = translator.translate(u'Hello', src='en', dest='chinese (simplified)')
assert result.dest == 'zh-cn'
def test_language_rfc1766(translator):
result = translator.translate(u'luna', src='it_ch@euro', dest='en')
assert result.text == u'moon'