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

17 lines
516 B
JavaScript

import { $TDX } from "../api/bridge.js";
import { replaceFunction } from "../api/patch.js";
import { TD } from "../api/td.js";
import { ensurePropertyExists } from "../api/utils.js";
/**
* Sets language for automatic translations.
*/
export default function() {
ensurePropertyExists(TD, "languages");
replaceFunction(TD.languages, "getSystemLanguageCode", function(func, args) {
const [ returnShortCode ] = args;
return returnShortCode ? ($TDX.translationTarget || "en") : func.apply(this, args);
});
};