Skip to content

Commit

Permalink
Rationalize tmdb and opensubtitles Chinese languages
Browse files Browse the repository at this point in the history
  • Loading branch information
courville committed Aug 17, 2024
1 parent b6a2014 commit ea8a061
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@
<string name="s_chinese">Chinese</string>
<string name="s_chinese_simplified">Simplified Chinese</string>
<string name="s_traditional_chinese">Traditional Chinese</string>
<string name="s_chinese_bilingual">Chinese bilingual</string>
<string name="s_chinese_mainland">Chinese (Mainland China)</string>
<string name="s_chinese_hk">Chinese (Hong Kong)</string>
<string name="s_chinese_tw">Chinese (Taiwan)</string>
<string name="s_spanish_la">Spanish (LA)</string>
<string name="s_extremaduran">Extremaduran</string>
<string name="s_montenegrin">Montenegrin</string>
Expand All @@ -388,7 +392,6 @@
<string name="s_santali">Santali</string>
<string name="s_syriac">Syriac</string>
<string name="s_toki_pona">Toki Pona</string>
<string name="s_chinese_bilingual">Chinese bilingual</string>
<string name="s_none">None</string>

<!-- Player errors -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,29 @@ public class VideoPreferencesCommon implements OnSharedPreferenceChangeListener

// update with: `curl --request GET --url https://api.opensubtitles.com/api/v1/infos/languages | jq -r '.data[].language_code' | sort -u | gpaste -sd "|"`
// list exceptions via `| grep -E '.{3,}' | gpaste -sd "|"` "zh-cn|pt-pt|pt-br|zh-tw"
private static final String OPENSUBTITLES_LANGUAGES = "ab|af|an|ar|as|at|az|be|bg|bn|br|bs|ca|cs|cy|da|de|ea|el|en|eo|es|et|eu|ex|fa|fi|fr|ga|gd|gl|he|hi|hr|hu|hy|ia|id|ig|is|it|ja|ka|kk|km|kn|ko|ku|lb|lt|lv|ma|me|mk|ml|mn|mr|ms|my|ne|nl|no|nv|oc|or|pl|pm|pr|ps|pt-br|pt-pt|ro|ru|sd|se|si|sk|sl|so|sp|sq|sr|sv|sw|sx|sy|ta|te|th|tk|tl|tp|tr|tt|uk|ur|uz|vi|ze|zh-cn|zh-tw";
private static final String OPENSUBTITLES_LANGUAGES = "ab|af|an|ar|as|at|az|be|bg|bn|br|bs|ca|cs|cy|da|de|ea|el|en|eo|es|et|eu|ex|fa|fi|fr|ga|gd|gl|he|hi|hr|hu|hy|ia|id|ig|is|it|ja|ka|kk|km|kn|ko|ku|lb|lt|lv|ma|me|mk|ml|mn|mr|ms|my|ne|nl|no|nv|oc|or|pl|pm|pr|ps|pt-br|pt-pt|ro|ru|sd|se|si|sk|sl|so|sp|sq|sr|sv|sw|sx|sy|ta|te|th|tk|tl|tp|tr|tt|uk|ur|uz|vi|ze|zh-cn|zh-tw|zh-ca";

// see https://developer.themoviedb.org/docs/languages
// curl --request GET --url 'https://api.themoviedb.org/3/configuration/languages?api_key=APIKEY' | jq '.[] | .iso_639_1' | sed 's/"\([^"]*\)"/\1/g' | grep -v mo | grep -v xx | sort -u | paste -sd "|" -
// to do after: add manually pt-br and substitute cn=zh-tw and zh=zh-cn
// zh = Mandarin -> Chinese Simplified (zh-cn) or Chinese
// cn = Cantonese -> Chinese Traditional (zh-tw)
public final static String TMDB_LANGUAGES = "aa|ab|ae|af|ak|am|an|ar|as|av|ay|az|ba|be|bg|bi|bm|bn|bo|br|bs|ca|ce|ch|zh-tw|co|cr|cs|cu|cv|cy|da|de|dv|dz|ee|el|en|eo|es|et|eu|fa|ff|fi|fj|fo|fr|fy|ga|gd|gl|gn|gu|gv|ha|he|hi|ho|hr|ht|hu|hy|hz|ia|id|ie|ig|ii|ik|io|is|it|iu|ja|jv|ka|kg|ki|kj|kk|kl|km|kn|ko|kr|ks|ku|kv|kw|ky|la|lb|lg|li|ln|lo|lt|lu|lv|mg|mh|mi|mk|ml|mn|mr|ms|mt|my|na|nb|nd|ne|ng|nl|nn|no|nr|nv|ny|oc|oj|om|or|os|pa|pi|pl|ps|pt|pt-br|qu|rm|rn|ro|ru|rw|sa|sc|sd|se|sg|sh|si|sk|sl|sm|sn|so|sq|sr|ss|st|su|sv|sw|ta|te|tg|th|ti|tk|tl|tn|to|tr|ts|tt|tw|ty|ug|uk|ur|uz|ve|vi|vo|wa|wo|xh|yi|yo|za|zh-cn|zu";
public final static String TMDB_LANGUAGES = "aa|ab|ae|af|ak|am|an|ar|as|av|ay|az|ba|be|bg|bi|bm|bn|bo|br|bs|ca|ce|ch|zh-tw|co|cr|cs|cu|cv|cy|da|de|dv|dz|ee|el|en|eo|es|et|eu|fa|ff|fi|fj|fo|fr|fy|ga|gd|gl|gn|gu|gv|ha|he|hi|ho|hr|ht|hu|hy|hz|ia|id|ie|ig|ii|ik|io|is|it|iu|ja|jv|ka|kg|ki|kj|kk|kl|km|kn|ko|kr|ks|ku|kv|kw|ky|la|lb|lg|li|ln|lo|lt|lu|lv|mg|mh|mi|mk|ml|mn|mr|ms|mt|my|na|nb|nd|ne|ng|nl|nn|no|nr|nv|ny|oc|oj|om|or|os|pa|pi|pl|ps|pt|pt-br|qu|rm|rn|ro|ru|rw|sa|sc|sd|se|sg|sh|si|sk|sl|sm|sn|so|sq|sr|ss|st|su|sv|sw|ta|te|tg|th|ti|tk|tl|tn|to|tr|ts|tt|tw|ty|ug|uk|ur|uz|ve|vi|vo|wa|wo|xh|yi|yo|za|zh-cn|zh-hk|zu";

// basic Chinese howto
// zh-cn Chinese (Mainland China): Mandarin (mostly in Simplified charset)
// zh-tw Chinese (Taiwan): Min (mostly in Traditional charset)
// zh-hk Chinese (Hong Kong): Cantonese
// Character set = Simplified or Traditional
// opensubtitles
// zh-ca = Chinese (Cantonese) -> zh-hk Chinese (Hong Kong),
// zh-cn = Chinese (simplified) -> zh-cn Chinese (Mainland China),
// zh-tw = Chinese (traditional) -> zh-tw Chinese (Taiwan)
// ze = Chinese bilingual -> Chinese Cantonese + English
// tmdb (proposed by Yu)
// do not use zh Mandarin = zh-cn, Chinese (Mainland China)
// do not use cn Cantonese = zh-hk, Chinese (Hong Kong)
// add zh-tw, Chinese (Taiwan)

// should we provide adaptive refresh rate for all (not only on TV)
private static final boolean REFRESHRATE_FORALL = true;
Expand Down

0 comments on commit ea8a061

Please sign in to comment.