LootReserve

LootReserve

1M Downloads

Minox fix for language support

Xikun201 opened this issue · 1 comments

commented

Hello everyone,

i am using a german client.
I know you explicitly said that you only support and test on the english client.
While rolling the dice I saw following difference:

English client:
%s rolls %d (%d-%d)
get's transformed into
(.+) rolls (%d+) %((%d+)-(%d+))%)

Which works fine.
But german client has following starting string:
%1$s würfelt. Ergebnis: %2$d (%3$d-%4$d)
This is because sometimes the order of formated strings can be different depending on the language.
So your converter to regex is not working.

Changing this line inside the code helped me fixing this problem:
File,Line: LootReserve.lua:840

return fmt:gsub("%(", "%%("):gsub("%)", "%%)"):gsub("%%s", "(.+)"):gsub("%%d", "(%%d+)");
to
return fmt:gsub("%d+%$",""):gsub("%(", "%%("):gsub("%)", "%%)"):gsub("%%s", "(.+)"):gsub("%%d", "(%%d+)");
I hope this could get merged into your project. This would bring our gild to using the original one and not a manually fixed version. This change only works because german and english order is the same. Could break if any other language has different order.

From the name of our guild:
THANK YOU A LOT FOR THIS GREAT ADDON.

Greetings.

commented

Closed due to merge: #5

Thanks a lot! And also nice code style :) 👍