Closed caperucitaferoz closed 3 years ago
Sorry, I'm a little bit tired at the moment. So some languages are using 639 while others do use 3166 because of specials characters or something?
First of all, thanks for your work and sorry for my bad English. The problem is that in your script, for the "language_code" settings, values such as: es-ES, es-MX, pt-BR, pt-PT, ... are allowed and this is not the ISO 639-1 codes that returns the tmdb API, therefore the conditional of its line 520 is never met. The APi returns for the list of translations the language code (ISO 639-1) and the country code (ISO 3166-1) as you can see in the API documentation. Example: "Coming 2 America"
My code looks for the translation corresponding to the language and country selected in the settings (respecting the list of possible values that you have prefixed). In the case of not finding the specific translation of the country, but if any other in the same language will also show it. Another option would have been to change its valid values for "language_code" setting only valid values from ISO 639-1 and use the "country_code" setting to compare with the ISO 3166-1 field returned by the API. But there are countries that do not have an age certification system and take the US or any other as a reference. Also this could lead to illogical combinations like "es-DE" for example.
@caperucitaferoz
Ah, now I get you. You are totally right. Thanks. Since I'm in the office with restricted permissions, could you prepare a PR for me?
OK no problem. Although I see that your last commits are only in the matrix branch, have you stopped updating the version for leia? Should I send a PR for each branch?
Just for Matrix, thanks. I'll cherry pick the changes for Leia.
The language_code settings of the language-country type are actually a combination of the iso_639_1 and iso_3166_1 standards. Therefore, in this case, the translation sought is not returned as this conditional is never met https://github.com/sualfred/script.embuary.info/blob/7dc874783c355d473fdf60d9a21e97f99574840f/resources/lib/tmdb.py#L520
I propose for (Matrix and Leia):