remade localization system once again

- new localization system: fast, dynamic, way more organized
- localization strings are WAY more descriptive
- it's now easier to add support for other languages (just one loc file instead of five)
- localization now falls back to english if localized string isnt available
- got rid of all static language selectors (probably)
- slightly updated english and russian strings
- miscellaneous settings items have been bundled together and moved to the bottom, cause they're used the least
- bottom links should no longer touch the popup border on overflow
- rearranged popup order in the rendered page
- bumped version up to 2.2.5

if you see strings that are like this: !!EXAMPLE!! or withoutspace please file an issue on github
This commit is contained in:
wukko
2022-07-24 16:54:05 +06:00
parent 8d275b0213
commit a4a9af6120
32 changed files with 339 additions and 299 deletions

View File

@@ -1,11 +1,11 @@
import got from "got";
import loc from "../sub/i18n.js";
import loc from "../../localization/manager.js";
import { services } from "../config.js";
const configSt = services.twitter;
async function fetchTweetInfo(obj) {
let cantConnect = { error: loc('en', 'apiError', 'cantConnectToAPI', 'twitter') }
let cantConnect = { error: loc(obj.lang, 'ErrorCantConnectToServiceAPI', 'twitter') }
try {
let _headers = {
"Authorization": `Bearer ${configSt.token}`,
@@ -28,11 +28,11 @@ async function fetchTweetInfo(obj) {
})
return JSON.parse(req_status.body);
} catch (err) {
return { error: cantConnect };
return cantConnect;
}
}
export default async function (obj) {
let nothing = { error: loc('en', 'apiError', 'nothingToDownload') }
let nothing = { error: loc(obj.lang, 'ErrorEmptyDownload') }
try {
let parsbod = await fetchTweetInfo(obj);
if (!parsbod.error) {
@@ -52,6 +52,6 @@ export default async function (obj) {
}
} else return parsbod;
} catch (err) {
return { error: loc("en", "apiError", "errorFetch") };
return { error: loc(obj.lang, 'ErrorBadFetch') };
}
}