translate issue #7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
with: ['a', 'b']
%%s
bot: %a
correct: %s
%s %s %s
bot: a b %s
correct: %s %s %s
%s %3$s
bot: a %3$s
correct: %s %3$s
For issues 2 and 3, this can be resolved by returning the original string whenever an error occurs (like there not being any arguments left even though there's an %s specified, or trying to get an argument at an invalid index).
However, in my experience, to properly fix the first issue, you cannot just replace %% with % and then run the rest of the sprintf-like function like usual because this would execute as so:
%%s -> %s -> a
I think you could modify your current Regex to accept % as well as s for the format specifier, but of course instead of actually inserting the argument at the current position it would instead insert a literal %. How well this would work with the JavaScript replaceAll function, which I am not familiar with.
Personally, I iterate through each character of the format string and then construct the translated String based on the contents of the format string and the arguments, throwing an exception when there's some sort of issue and in the code that invokes the sprintf function just returns the format string if an error occurred.
do you know how to get system chat isActionBar ?
Shouldn't it just be a field in the packet object?
... i found other packet.