Skip to content

Commit b22cf08

Browse files
committed
Add Brazillian Portuguese to supported_languages
1 parent 1ceb961 commit b22cf08

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

subliminal/converters/subscene.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

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

18+
from_subscene_with_country = {
19+
'Brazillian Portuguese': ('por', 'BR')
20+
}
21+
22+
to_subscene_with_country = {val: key for key, val in from_subscene_with_country.items()}
23+
1824
exact_languages_alpha3 = [
1925
'ara', 'aze', 'bel', 'ben', 'bos', 'bul', 'cat', 'ces', 'dan', 'deu',
2026
'eng', 'epo', 'est', 'eus', 'fin', 'fra', 'heb', 'hin', 'hrv', 'hun',
@@ -26,9 +32,8 @@
2632

2733
# TODO: specify codes for unspecified_languages
2834
unspecified_languages = [
29-
'Big 5 code', 'Brazillian Portuguese', 'Bulgarian/ English',
30-
'Chinese BG code', 'Dutch/ English', 'English/ German',
31-
'Hungarian/ English', 'Rohingya'
35+
'Big 5 code', 'Bulgarian/ English', 'Chinese BG code',
36+
'Dutch/ English', 'English/ German', 'Hungarian/ English', 'Rohingya'
3237
]
3338

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

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

45+
supported_languages.update({Language(lang, cr) for lang, cr in to_subscene_with_country})
46+
4047

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

58+
if (alpha3, country) in to_subscene_with_country:
59+
to_subscene_with_country[(alpha3, country)]
60+
5161
message = "unsupported language for subscene: %s, %s, %s" \
5262
% (alpha3, country, script)
5363
raise ConfigurationError(message)
5464

5565
def reverse(self, code):
66+
if code in from_subscene_with_country:
67+
return from_subscene_with_country[code]
68+
5669
if code in from_subscene:
5770
return (from_subscene[code],)
5871

0 commit comments

Comments
 (0)