I'm not sure where the best way is to report suggestions/issues for LibBabble. The only reference I found was the note about credits to ckknight but I'm lacking any contact information.
So I try my luck here. Feel free to point me to the right place to report/discuss the issue/patch.
Steps to reproduce the underlying issue:
Run the attached test-project in WoW.
Actual result:
[...]\Test\Libs\LibBabble-Test-3.0\LibBabble-3.0.lua:31: attempt to index field 'current' (a nil value)
Expected result:
Error output: [...]\Test\Libs\LibBabble-Test-3.0\LibBabble-3.0.lua:56: Translation "Foo" not found.
Tracing down the underlying error points me to db.current being nil in this case (no table was set-up for the given local).
According to the documentation of: GetLookupTable() it states that:
"If you try to access a nonexistent key, it will warn but allow the code to pass through."
So this is definitely not the case for this error-scenario.
My suggested patch would be to make the following change to lookup_mt and hence print out the error message instead of running in a Lua error. See attached patch-file.
Since this patch implies a behavior change, it'd imply a required boost to 3 of LibBabble-3.0. Hence it'd be unfeasable for module-writers to make the changes on their modules only.
Babble modules are usually written in such a way that they themself error out when no locale is available at all.
The error you're getting is not ideal either, it should either return the english version or throw a meaningful error.
However, i don't see your patch fixing this in either of these ways.
Your test-setup is faulty, because its a requirement that at least the base translation table is registered with LibBabble, which your test library does not do, so i think you're trying to fix the wrong error there.
db.base should always be set, or whoever wrote that babble module just did something wrong (not setting a base translation)
db.current not being available is another matter, but your patch doesn't address that.
Sorry I obviously mixed up some code changes when creating the patch and test project. Attached is an updated version of the test code and the patch.
As u've clarified that not specifying a base-translation is considered an unsupported state of the lib, I removed the suggested fix for handling a missing base-localization and just added the check for a missing current-table.
Is there any further thing I can do to help u with getting the Patch into LibBabble or isn't that wanted (maybe due to its limited application?)? Any release-procedure I can help with/follow to integrate the code changes into the code repository?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm not sure where the best way is to report suggestions/issues for LibBabble. The only reference I found was the note about credits to ckknight but I'm lacking any contact information.
So I try my luck here. Feel free to point me to the right place to report/discuss the issue/patch.
Steps to reproduce the underlying issue:
Run the attached test-project in WoW.
Actual result:
[...]\Test\Libs\LibBabble-Test-3.0\LibBabble-3.0.lua:31: attempt to index field 'current' (a nil value)
Expected result:
Error output: [...]\Test\Libs\LibBabble-Test-3.0\LibBabble-3.0.lua:56: Translation "Foo" not found.
Tracing down the underlying error points me to db.current being nil in this case (no table was set-up for the given local).
According to the documentation of: GetLookupTable() it states that:
"If you try to access a nonexistent key, it will warn but allow the code to pass through."
So this is definitely not the case for this error-scenario.
My suggested patch would be to make the following change to lookup_mt and hence print out the error message instead of running in a Lua error. See attached patch-file.
Since this patch implies a behavior change, it'd imply a required boost to 3 of LibBabble-3.0. Hence it'd be unfeasable for module-writers to make the changes on their modules only.
Regards,
Stefan
The error you're getting is not ideal either, it should either return the english version or throw a meaningful error.
However, i don't see your patch fixing this in either of these ways.
Your test-setup is faulty, because its a requirement that at least the base translation table is registered with LibBabble, which your test library does not do, so i think you're trying to fix the wrong error there.
db.base should always be set, or whoever wrote that babble module just did something wrong (not setting a base translation)
db.current not being available is another matter, but your patch doesn't address that.
As u've clarified that not specifying a base-translation is considered an unsupported state of the lib, I removed the suggested fix for handling a missing base-localization and just added the check for a missing current-table.