1515
1616to_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+
1824exact_languages_alpha3 = [
1925 'ara' , 'aze' , 'bel' , 'ben' , 'bos' , 'bul' , 'cat' , 'ces' , 'dan' , 'deu' ,
2026 'eng' , 'epo' , 'est' , 'eus' , 'fin' , 'fra' , 'heb' , 'hin' , 'hrv' , 'hun' ,
2632
2733# TODO: specify codes for unspecified_languages
2834unspecified_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
3439supported_languages = {Language (lang ) for lang in exact_languages_alpha3 }
3742
3843supported_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
4148class 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