fix %-n$s
This commit is contained in:
parent
e616214c72
commit
2e1de26f34
1 changed files with 5 additions and 5 deletions
|
@ -235,9 +235,9 @@ function parseMinecraftMessage(component) {
|
||||||
return "%s";
|
return "%s";
|
||||||
});
|
});
|
||||||
|
|
||||||
translateString = translateString.replace(/%(\d+)\$s/g, (match, index, stringindex, string) => {
|
translateString = translateString.replace(/%(-?\d+)\$s/g, (match, index, stringindex, string) => {
|
||||||
const argIndex = parseInt(index) - 1;
|
const argIndex = index - 1;
|
||||||
|
|
||||||
if (argIndex < 0 || argIndex >= withArgs.length) {
|
if (argIndex < 0 || argIndex >= withArgs.length) {
|
||||||
DefaultMsg = true;
|
DefaultMsg = true;
|
||||||
return match;
|
return match;
|
||||||
|
@ -320,13 +320,13 @@ function parseMinecraftMessageNoColor(component) {
|
||||||
});
|
});
|
||||||
|
|
||||||
translateString = translateString.replace(/%(\d+)\$s/g, (match, index, stringindex, string) => {
|
translateString = translateString.replace(/%(\d+)\$s/g, (match, index, stringindex, string) => {
|
||||||
const argIndex = parseInt(index) - 1;
|
const argIndex = index - 1;
|
||||||
|
|
||||||
if (argIndex < 0 || argIndex >= withArgs.length) {
|
if (argIndex < 0 || argIndex >= withArgs.length) {
|
||||||
DefaultMsg = true;
|
DefaultMsg = true;
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stringindex > 0 && string[stringindex - 1] === '%') {
|
if (stringindex > 0 && string[stringindex - 1] === '%') {
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue