[AO] [ADN] Improve API locale handling

This commit is contained in:
AnimeDL 2024-04-17 11:59:47 -07:00
parent 78630bb5f7
commit ba08c7b4e7
4 changed files with 6 additions and 4 deletions

2
adn.ts
View file

@ -78,7 +78,7 @@ export default class AnimationDigitalNetwork implements ServiceClass {
public async cli() {
console.info(`\n=== Multi Downloader NX ${packageJson.version} ===\n`);
const argv = yargs.appArgv(this.cfg.cli);
if (argv.locale !== 'en-US')
if (['fr', 'de'].includes(argv.locale))
this.locale = argv.locale;
if (argv.debug)
this.debug = true;

2
ao.ts
View file

@ -84,7 +84,7 @@ export default class AnimeOnegai implements ServiceClass {
public async cli() {
console.info(`\n=== Multi Downloader NX ${packageJson.version} ===\n`);
const argv = yargs.appArgv(this.cfg.cli);
if (argv.locale !== 'en-US')
if (['pt', 'es'].includes(argv.locale))
this.locale = argv.locale;
if (argv.debug)
this.debug = true;

View file

@ -19,7 +19,8 @@ class ADNHandler extends Base implements MessageHandler {
public getDefaults() {
const _default = yargs.appArgv(this.adn.cfg.cli, true);
this.adn.locale = _default.locale;
if (['fr', 'de'].includes(_default.locale))
this.adn.locale = _default.locale;
}
public async auth(data: AuthData) {

View file

@ -19,7 +19,8 @@ class AnimeOnegaiHandler extends Base implements MessageHandler {
public getDefaults() {
const _default = yargs.appArgv(this.ao.cfg.cli, true);
this.ao.locale = _default.locale;
if (['es', 'pt'].includes(_default.locale))
this.ao.locale = _default.locale;
}
public async auth(data: AuthData) {