mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-16 08:27:03 +03:00
Auto detect lang
This commit is contained in:
10
LANG.js
10
LANG.js
@@ -1,23 +1,23 @@
|
|||||||
// File to store strings for diffrent languages
|
// File to store strings for diffrent languages
|
||||||
|
lang = navigator.language.replace("-", "_");
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
function getErrorMessage(lang, statusCode) {
|
function getErrorMessage(statusCode) {
|
||||||
if(lang.has(statusCode)) return lang.get(statusCode);
|
if(lang.has(statusCode)) return lang.get(statusCode);
|
||||||
return lang.get('Unknown').concat(" Error code: ") + statusCode;
|
return lang.get('Unknown').concat(" Error code: ") + statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function MSG(lang, message) {
|
function MSG(message) {
|
||||||
if(lang.has(message)) return lang.get(message);
|
if(lang.has(message)) return lang.get(message);
|
||||||
console.warn("Could not find key " + message + " for lang "+lang);
|
console.warn("Could not find key " + message + " for lang "+lang);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Declare Maps
|
//Declare Maps
|
||||||
var EN_US = new Map();
|
var en_US = new Map();
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
EN_US.set(400, 'Server said this request was invalid"')
|
en_US.set(400, 'Server said this request was invalid"')
|
||||||
.set(429, 'You have submitted too many sponsor times for this one video, are you sure there are this many?')
|
.set(429, 'You have submitted too many sponsor times for this one video, are you sure there are this many?')
|
||||||
.set(409, 'This has already been submitted before')
|
.set(409, 'This has already been submitted before')
|
||||||
.set(502, 'It seems the server is down. Contact the dev to inform them.')
|
.set(502, 'It seems the server is down. Contact the dev to inform them.')
|
||||||
|
|||||||
Reference in New Issue
Block a user