File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,17 @@ our %valid_languages = (
6262 zh_TW => {name => " 中文(繁體)" },
6363);
6464
65+ # We unfortunately have dialects to deal with now.
66+ our %language_aliases = (
67+ ' zh' => ' zh_CN' ,
68+ ' zh_Hans' => ' zh_CN' ,
69+ ' zh_Hant' => ' zh_TW' ,
70+ ' zh_HK' => ' zh_TW' ,
71+ ' zh_MO' => ' zh_TW' ,
72+ ' zh_SG' => ' zh_CN' ,
73+ ' zh_MY' => ' zh_CN' ,
74+ );
75+
6576NP::I18N::loc_lang(' en' );
6677
6778my $uc = Unicode::Collate-> new();
@@ -233,7 +244,10 @@ sub language {
233244sub valid_language {
234245 my $self = shift ;
235246 my @languages = @_ ;
236- return first { $valid_languages {$_ } } @languages ;
247+ return first {
248+ s / -/ _/ g ;
249+ $valid_languages {$_ } // $valid_languages {$language_aliases {$_ }}
250+ } @languages ;
237251}
238252
239253sub valid_languages {
You can’t perform that action at this time.
0 commit comments