Chocobozzz / PeerTube

ActivityPub-federated video streaming platform using P2P directly in your web browser
https://joinpeertube.org/
GNU Affero General Public License v3.0
12.95k stars 1.49k forks source link

Wrong interface locale after upgrading from v1.2.1 to v1.4.0, showing zh-Hans-CN instead of zh-Hant-TW #2103

Closed fweng322 closed 5 years ago

fweng322 commented 5 years ago

What happened? After upgrading PeerTube from v1.2.1 to v1.4.0, the web interfaces became zh-Hans-CN (Simplified Chinese) instead of zh-Hant-TW (Traditional Chinese). And there is no where to set or to specify the locale.

What do you expect to happen instead? Should show traditional Chinese interface instead of simplified Chinese

Steps to reproduce:

  1. Upgrade from v1.2.1 to v1.4.0

  2. The web interface locale changed

Additional information

Chocobozzz commented 5 years ago

Could you paste your Accept-Language request header please?

fweng322 commented 5 years ago

Could you paste your Accept-Language request header please?

Sorry, how to get it?

Findus23 commented 5 years ago

If you open your browsers developer tools (F12) and go to the network tab, you can select any request and should see in the details of the headers one that looks like this:

Accept-Language: de-AT,de;q=0.8,en-US;q=0.5,en;q=0.3
fweng322 commented 5 years ago

accept-language: zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7

fweng322 commented 5 years ago

Not sure if it is related: In the F12 dev tools, Network tab -> Name -> languages I found these answers:

https://peertube.slat.org/api/v1/videos/languages

{"aa":"Afar","ab":"Abkhazian","af":"Afrikaans","ak":"Akan","am":"Amharic","ar":"Arabic","an":"Aragonese","ase":"American Sign Language","as":"Assamese","av":"Avaric","avk":"Kotava","ay":"Aymara","az":"Azerbaijani","ba":"Bashkir","bm":"Bambara","be":"Belarusian","bn":"Bengali","bfi":"British Sign Language","bi":"Bislama","bo":"Tibetan","bs":"Bosnian","br":"Breton","bg":"Bulgarian","bzs":"Brazilian Sign Language","ca":"Catalan","cs":"Czech","ch":"Chamorro","ce":"Chechen","cv":"Chuvash","kw":"Cornish","co":"Corsican","cr":"Cree","cse":"Czech Sign Language","csl":"Chinese Sign Language","cy":"Welsh","da":"Danish","de":"German","dv":"Dhivehi","dsl":"Danish Sign Language","dz":"Dzongkha","el":"Greek","en":"English","eo":"Esperanto","et":"Estonian","eu":"Basque","ee":"Ewe","fo":"Faroese","fa":"Persian","fj":"Fijian","fi":"Finnish","fr":"French","fy":"Western Frisian","fsl":"French Sign Language","ff":"Fulah","gd":"Scottish Gaelic","ga":"Irish","gl":"Galician","gv":"Manx","gn":"Guarani","gsg":"German Sign Language","gu":"Gujarati","ht":"Haitian","ha":"Hausa","sh":"Serbo-Croatian","he":"Hebrew","hz":"Herero","hi":"Hindi","ho":"Hiri Motu","hr":"Croatian","hu":"Hungarian","hy":"Armenian","ig":"Igbo","ii":"Sichuan Yi","iu":"Inuktitut","id":"Indonesian","ik":"Inupiaq","is":"Icelandic","it":"Italian","jv":"Javanese","jbo":"Lojban","ja":"Japanese","jsl":"Japanese Sign Language","kl":"Kalaallisut","kn":"Kannada","ks":"Kashmiri","ka":"Georgian","kr":"Kanuri","kk":"Kazakh","km":"Khmer","ki":"Kikuyu","rw":"Kinyarwanda","ky":"Kirghiz","kv":"Komi","kg":"Kongo","ko":"Korean","kj":"Kuanyama","ku":"Kurdish","lo":"Lao","lv":"Latvian","li":"Limburgan","ln":"Lingala","lt":"Lithuanian","lb":"Luxembourgish","lu":"Luba-Katanga","lg":"Ganda","mh":"Marshallese","ml":"Malayalam","mr":"Marathi","mk":"Macedonian","mg":"Malagasy","mt":"Maltese","mn":"Mongolian","mi":"Maori","ms":"Malay (macrolanguage)","my":"Burmese","na":"Nauru","nv":"Navajo","nr":"South Ndebele","nd":"North Ndebele","ng":"Ndonga","ne":"Nepali (macrolanguage)","nl":"Dutch","nn":"Norwegian Nynorsk","nb":"Norwegian Bokmål","no":"Norwegian","ny":"Nyanja","oc":"Occitan","oj":"Ojibwa","or":"Oriya (macrolanguage)","om":"Oromo","os":"Ossetian","pa":"Panjabi","pks":"Pakistan Sign Language","pl":"Polish","pt":"Portuguese","ps":"Pushto","qu":"Quechua","rm":"Romansh","ro":"Romanian","rsl":"Russian Sign Language","rn":"Rundi","ru":"Russian","sg":"Sango","sdl":"Saudi Arabian Sign Language","sfs":"South African Sign Language","si":"Sinhala","sk":"Slovak","sl":"Slovenian","se":"Northern Sami","sm":"Samoan","sn":"Shona","sd":"Sindhi","so":"Somali","st":"Southern Sotho","es":"Spanish","sq":"Albanian","sc":"Sardinian","sr":"Serbian","ss":"Swati","su":"Sundanese","sw":"Swahili (macrolanguage)","sv":"Swedish","swl":"Swedish Sign Language","ty":"Tahitian","ta":"Tamil","tt":"Tatar","te":"Telugu","tg":"Tajik","tl":"Tagalog","th":"Thai","ti":"Tigrinya","tlh":"Klingon","to":"Tonga (Tonga Islands)","tn":"Tswana","ts":"Tsonga","tk":"Turkmen","tr":"Turkish","tw":"Twi","ug":"Uighur","uk":"Ukrainian","ur":"Urdu","uz":"Uzbek","ve":"Venda","vi":"Vietnamese","wa":"Walloon","wo":"Wolof","xh":"Xhosa","yi":"Yiddish","yo":"Yoruba","za":"Zhuang","zh":"Chinese","zu":"Zulu"}

However "zh":"Chinese" is ambiguous and is always the cause of problems like this issue. zh should be split into zh-TW, zh-CN, zh-HK, zh-SG, ... different locales/languages because though they all are a kind of Chinese, actually they all are quite different ones.

Chocobozzz commented 5 years ago

We do have the complete locales, but in peertube zh is an alias for zh-Hans-CN. The issue here is that we understand zh-Hant-TW, but not zh-TW. Please retry on https://peertube2.cpy.re/ and tell me if it's fixed.

fweng322 commented 5 years ago

Yes, this site https://peertube2.cpy.re/ shows Traditional Chinese (TW) interface. Thanks for your help.

Will it be an option to set in somewhere like local-production.yaml?

Chocobozzz commented 5 years ago

@fweng322 No, I'll fix this directly in the code

Chocobozzz commented 5 years ago

Fixed by https://github.com/Chocobozzz/PeerTube/commit/f69ec5f340638ef577e8f5b9b1fb844778656a1f