Skip to content

Commit

Permalink
Add Brazillian Portuguese to supported_languages
Browse files Browse the repository at this point in the history
  • Loading branch information
mamins1376 committed Mar 14, 2019
1 parent 1ceb961 commit b22cf08
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions subliminal/converters/subscene.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

to_subscene = {val: key for key, val in from_subscene.items()}

from_subscene_with_country = {
'Brazillian Portuguese': ('por', 'BR')
}

to_subscene_with_country = {val: key for key, val in from_subscene_with_country.items()}

exact_languages_alpha3 = [
'ara', 'aze', 'bel', 'ben', 'bos', 'bul', 'cat', 'ces', 'dan', 'deu',
'eng', 'epo', 'est', 'eus', 'fin', 'fra', 'heb', 'hin', 'hrv', 'hun',
Expand All @@ -26,9 +32,8 @@

# TODO: specify codes for unspecified_languages
unspecified_languages = [
'Big 5 code', 'Brazillian Portuguese', 'Bulgarian/ English',
'Chinese BG code', 'Dutch/ English', 'English/ German',
'Hungarian/ English', 'Rohingya'
'Big 5 code', 'Bulgarian/ English', 'Chinese BG code',
'Dutch/ English', 'English/ German', 'Hungarian/ English', 'Rohingya'
]

supported_languages = {Language(lang) for lang in exact_languages_alpha3}
Expand All @@ -37,6 +42,8 @@

supported_languages.update({Language(lang) for lang in to_subscene})

supported_languages.update({Language(lang, cr) for lang, cr in to_subscene_with_country})


class SubsceneConverter(LanguageReverseConverter):
codes = {lang.name for lang in supported_languages}
Expand All @@ -48,11 +55,17 @@ def convert(self, alpha3, country=None, script=None):
if alpha3 in to_subscene:
return to_subscene[alpha3]

if (alpha3, country) in to_subscene_with_country:
to_subscene_with_country[(alpha3, country)]

message = "unsupported language for subscene: %s, %s, %s" \
% (alpha3, country, script)
raise ConfigurationError(message)

def reverse(self, code):
if code in from_subscene_with_country:
return from_subscene_with_country[code]

if code in from_subscene:
return (from_subscene[code],)

Expand Down

0 comments on commit b22cf08

Please sign in to comment.