1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-11-23 17:42:46 +01:00
TweetDuck/resources/Content/tweetdeck/fix_missing_bing_translator_languages.js

24 lines
709 B
JavaScript

import { replaceFunction } from "../api/patch.js";
import { TD } from "../api/td.js";
import { ensurePropertyExists } from "../api/utils.js";
/**
* Adds missing languages for Bing Translator (Bengali, Icelandic, Tagalog, Tamil, Telugu, Urdu).
*/
export default function() {
ensurePropertyExists(TD, "languages", "getSupportedTranslationSourceLanguages");
const newCodes = [ "bn", "is", "tl", "ta", "te", "ur" ];
const codeSet = new Set(TD.languages.getSupportedTranslationSourceLanguages());
for (const lang of newCodes) {
codeSet.add(lang);
}
const codeList = [ ...codeSet ];
replaceFunction(TD.languages, "getSupportedTranslationSourceLanguages", function() {
return codeList;
});
};