Kodi Community Forum
Req Can't find Cantonese in audio and subtitle language - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Translations and Languages (https://forum.kodi.tv/forumdisplay.php?fid=90)
+--- Thread: Req Can't find Cantonese in audio and subtitle language (/showthread.php?tid=368373)



Can't find Cantonese in audio and subtitle language - MAN-GOR - 2022-05-25

Cantonese is the official language of Hong Kong and Macau, please add this rare language, thanks.


RE: Can't find Cantonese in audio and subtitle language - Klojum - 2022-05-25

(2022-05-25, 07:17)MAN-GOR Wrote: please add this rare language, thanks.

If we can add it, it will still require the actual translations of all Kodi texts, core and add-ons. Are you volunteering yourself for that task?


RE: Can't find Cantonese in audio and subtitle language - Gade - 2022-05-25

It is possible to add new languages.
We just added Filipino (Tagalog) a few days ago.

But it requires a lot of dedication and time from translators to add an entire new language.
Kodi core alone has more than 4000 strings.

Like Klojum writes: are you willing and dedicated to do this?


RE: Can't find Cantonese in audio and subtitle language - MAN-GOR - 2022-05-25

(2022-05-25, 10:30)Klojum Wrote: it will still require the actual translations of all Kodi texts, core and add-ons
 
(2022-05-25, 10:36)Gade Wrote: But it requires a lot of dedication and time from translators to add an entire new language.

Oh, I don't mean "interface language", just "audio language" and "subtitle language".
Does adding only "Cantonese" to "Preferred audio language" and "Preferred subtitle language" also require translation?


RE: Can't find Cantonese in audio and subtitle language - Klojum - 2022-05-25

(2022-05-25, 11:41)MAN-GOR Wrote: Oh, I don't mean "interface language", just "audio language" and "subtitle language".
Does adding only "Cantonese" to "Preferred audio language" and "Preferred subtitle language" also require translation?

I only use the default English language in the Kodi interface. AFAIK, language selections tend to be in English only, so that would not be a problem. But the language choice for Cantonese would have to be added to the country/language list.


RE: Can't find Cantonese in audio and subtitle language - scott967 - 2022-05-25

There is a problem in Kodi in that it only recognizes ISO 639-1 and 639-2 language tags, although it is possible to use advancedsettings.xml file to add custom languages.

That said, the UI language and subtitle language system would provide Mandarin in traditional script for use in Cantonese.  There is an issue with fonts though in that currently Kodi does not have an easy way to specify a Hong Kong variant of CJK font.

But for selecting an audio language I'm not sure that YUE can be specified (would have to check).  YUE is defined in ISO 639-3 but currently Kodi doesn't reference 639-3 not the more inclusive BCP-47.  So I am not sure but I don't think the current translation system for the UI would allow for YUE (or Southern Min - NAM).

scott s.
.


RE: Can't find Cantonese in audio and subtitle language - MAN-GOR - 2022-05-26

(2022-05-25, 22:57)scott967 Wrote: use advancedsettings.xml file to add custom languages

Can I specify "Preferred audio language" and "Preferred subtitle language" in advancedsettings.xml?
Similar to PotPlayer specifying language or track name keywords, for example, I set the Preferred language to be "yue can hk"
Then PotPlayer will automatically select the track with "yue" in the language or track name. If there is no such track name, it will automatically select the track with "can". If there is no such track name, it will automatically select the track with "hk".

In addition, if "Interface Language" is not "Chinese (Traditional)" or "Chinese (Simple)"
But "Preferred subtitle language" select "Chinese (Traditional)" or "Chinese (Simple)", it will not automatically select "Chinese" subtitle track.
But if "Preferred subtitle language" selects "Chinese", the "Chinese" subtitle track will be automatically selected.
Is this normal?


RE: Can't find Cantonese in audio and subtitle language - Karellen - 2022-05-26

(2022-05-26, 05:13)MAN-GOR Wrote: Can I specify "Preferred audio language" and "Preferred subtitle language" in advancedsettings.xml?
Looks like you can, but I won't be of much help as I have not used this setting.
Maybe try experimenting until someone with more knowledge can advise you.
https://kodi.wiki/view/Advancedsettings.xml#languagecodes


RE: Can't find Cantonese in audio and subtitle language - MAN-GOR - 2022-05-26

(2022-05-25, 22:57)scott967 Wrote: use advancedsettings.xml file to add custom languages.
 
(2022-05-26, 05:31)Karellen Wrote: Looks like you can

Probably know where the problem is, "Chinese (Traditional)", "Chinese (Simple)" and "Cantonese" will only be displayed as "Chinese" in the language tag, and Kodi's "Preferred language" only detects language tags.

The solution should only be to add new features, add the preferred language setting of PotPlayer to Kodi.
Detect track names, not language tags.


RE: Can't find Cantonese in audio and subtitle language - Klojum - 2022-05-26

(2022-05-26, 07:31)MAN-GOR Wrote: Detect track names, not language tags.

The problem there is, IMO, is that track names/descriptions are not always consistent. Typos and other mismatches or additions (e.g. "Director's comments") will flunk the correct choice of subtitle selection.


RE: Can't find Cantonese in audio and subtitle language - MAN-GOR - 2022-05-26

(2022-05-26, 07:49)Klojum Wrote: track names/descriptions are not always consistent. Typos and other mismatches or additions (e.g. "Director's comments") will flunk the correct choice of subtitle selection.

Let the user choose "Use language tag" or "Use track description"?
the default is "Use language tag"
And "Use track description" allows users to input description keywords

For example I type "can yue trad"
It will automatically select "cantonese" from the track description first, if there is no "can", it will automatically select the next keyword "yue", if there is no "yue", it will automatically select the next keyword "trad"


RE: Can't find Cantonese in audio and subtitle language - scott967 - 2022-05-27

I did a little digging, and I see that tmdb scraper has a pseudo-639-1 code of cn for Cantonese, while they declare zh to be Mandarin.  I couldn't quickly check tvdb as their v4 api is kind of a pain to do a quick test on.  So at least it is possible to scrape but as of tmdb python scraper 1.6.2+matrix.1 cn-hk isn't available as a language option (I will submit a PR for that if I can).

But I'm not sure how to determine if a audio or sub is intended as Cantonese, unless provided as a stand-alone file and you as .Cantonese or .YUE to the filename and also to advancedsettings.

From what I see on fansub sites they use a pseudo-639-2 code of chs and cht to indicate script for download sub files, but no way of knowing if it's Cantonese (maybe assume cht is?)

I don't know how to handle internal audio/sub tracks.  I know mkv container has a metadata field for BCP-47 but I'm pretty sure we use ffmpeg as the metadata decoder and it only decodes the 639-2 field (and don't know of any convention there -- seems like zho or chi is the normal fill value).  And no idea about physical media (DVD/BD) or other container formats like mp4.

But if you have a handle on how Cantonese is typically indicated in an AV media that would help.

scott s.
.


RE: Can't find Cantonese in audio and subtitle language - MAN-GOR - 2022-05-27

(2022-05-27, 01:28)scott967 Wrote: From what I see on fansub sites they use a pseudo-639-2 code of chs and cht to indicate script for download sub files, but no way of knowing if it's Cantonese (maybe assume cht is?)
In the Chinese language circle, "chs" stands for "Chinese (Simple)" and "cht" stands for "Chinese (Traditional)".
Because both have the same language tag, people add "chs" and "cht" to the subtitle track description to differentiate.
But I'm not sure if the same is true for "pseudo-639-2 code".

(2022-05-27, 01:28)scott967 Wrote: no idea about physical media (DVD/BD)
I have some BDISOs of Hong Kong movies.
After adding them to mkvtoolnix, the language label of the Cantonese audio track also uses "Chinese (zh)", which is the same as the Mandarin audio track.

(2022-05-27, 01:28)scott967 Wrote: But if you have a handle on how Cantonese is typically indicated in an AV media that would help.
In any case, thanks for your test, it may not be possible to "Preferred Cantonese language" in the current environment.


RE: Can't find Cantonese in audio and subtitle language - MAN-GOR - 2022-06-06

(2022-05-25, 22:57)scott967 Wrote: But for selecting an audio language I'm not sure that YUE can be specified (would have to check).  YUE is defined in ISO 639-3 but currently Kodi doesn't reference 639-3 not the more inclusive BCP-47.  So I am not sure but I don't think the current translation system for the UI would allow for YUE (or Southern Min - NAM).

[font]Oh, I haven't tested the audio track before, and now I found out that kodi allows the "yue" language tag in the audio track.
Use "advancedsettings.xml" to add "yue" option, and then select "Chinese (Yue)" in "Preferred Audio Language", the video will automatically select Cantonese audio track.
But the subtitles are still can't automatically selected.

My advancedsettings.xml setting:[/font]
Quote:<advancedsettings version="1.0">
<languagecodes>
<code>
<short>yue</short>
<long>Chinese (Yue)</long>
</code>
</languagecodes>
</advancedsettings>



This forum uses Lukasz Tkacz MyBB addons.