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 @@ -59,6 +59,17 @@ our %valid_languages = (
5959 zh_TW => {name => " 中文(繁體)" },
6060);
6161
62+ # We unfortunately have dialects to deal with now.
63+ our %language_aliases = (
64+ ' zh' => ' zh_CN' ,
65+ ' zh_Hans' => ' zh_CN' ,
66+ ' zh_Hant' => ' zh_TW' ,
67+ ' zh_HK' => ' zh_TW' ,
68+ ' zh_MO' => ' zh_TW' ,
69+ ' zh_SG' => ' zh_CN' ,
70+ ' zh_MY' => ' zh_CN' ,
71+ );
72+
6273NP::I18N::loc_lang(' en' );
6374
6475my $uc = Unicode::Collate-> new();
@@ -230,7 +241,10 @@ sub language {
230241sub valid_language {
231242 my $self = shift ;
232243 my @languages = @_ ;
233- return first { $valid_languages {$_ } } @languages ;
244+ return first {
245+ s / -/ _/ g ;
246+ $valid_languages {$_ } || $valid_languages {$language_aliases {$_ }}
247+ } @languages ;
234248}
235249
236250sub valid_languages {
You can’t perform that action at this time.
0 commit comments