Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
swishly
Posts: 6
Joined: Tue Jun 06, 2017 7:51 pm

REST search API: language attribute inconsistencies

Tue Jan 10, 2023 10:02 pm

The search API "https://api.opensubtitles.com/api/v1/subtitles" takes a "language" query parameter, however it is unclear what values are supported.

Without making it explicit, the documentation makes it sounds like the ISO 639-1 should be used (2 character code, e.g "en" for English, "pt" for Portuguese) - however in some circumstances the API only responds if the BCP-47 code is used (e.g. "en-US" for American English or "pt-BR" for Brazilian Portuguese)

For example

Using ISO 639-1
40+ hits for languages=en (https://api.opensubtitles.com/api/v1/su ... _id=317219)
0 hits for languages=pt (https://api.opensubtitles.com/api/v1/su ... _id=317219)

Using BCP-47
0 hits for languages=en-US (https://api.opensubtitles.com/api/v1/su ... _id=317219)
20+ hits for languages=pt-BR (https://api.opensubtitles.com/api/v1/su ... _id=317219)


We have tested with 3 languages so far. It seems that English & French require a 2-character code, but Portuguese languages requires a BCP-47 code. Not sure about other languages at this point.

It would be great if this could be standardized so the 2-character code can be used for every language.

os_dev
Posts: 194
Joined: Wed Oct 17, 2018 3:42 pm

Re: REST search API: language attribute inconsistencies

Thu Jan 12, 2023 7:46 am

We do use a logic of 2 digits language when it is not localised, like "en" or "fr", and a 4 digits when it is, like "pt-BR" or "pt-PB"

We use the same logic and fallbacks as the internal localisation code (ruby i18n)

the list of languages can be queried here https://api.opensubtitles.com/api/v1/infos/languages

as documented here https://opensubtitles.stoplight.io/docs ... -languages

Return to “Programs using OS”

Who is online

Users browsing this forum: No registered users and 34 guests