Map Pin Not Working in zhCN & zhTW
LiangYuxuan opened this issue · 9 comments
AddOn is calling C_PetJournal.GetPetInfoBySpeciesID
for tooltipSource
and parsing it for pet source, in the following function.
WoWAddon-BattlePetCompletionist/Modules/Data/DataModule.lua
Lines 195 to 216 in 923791d
The line 197 is finding colon in English character (:
), which works fine in most of locales. However, in zhCN & zhTW, Chinese character :
is used in localized tooltipSource
, and the index
will be nil, resulting the function returns nil, disabling the pin.
I'm replacing line 197 to the following line and make it work again.
local index = string.find(tooltipSource, "[::]", 1, false)
Dumping some related data
Dump: value=C_PetJournal.GetPetInfoBySpeciesID(515)
[1]="初生孢芽",
[2]=134532,
[3]=1,
[4]=62564,
[5]="|cFFFFD200宠物对战:|r赞加沼泽",
[6]="这些矮墩墩的小家伙经常会在寻找它们最爱的食物荧光菌帽时陷入麻烦。",
[7]=true,
[8]=true,
[9]=false,
[10]=false,
[11]=true,
[12]=42554,
[13]=0.40000000596046
Dump: BATTLE_PET_SOURCE_5
BATTLE_PET_SOURCE_5="宠物对战"
Might be related to #21 .
@davidmc24 can you take a look at #41 ?
@LiangYuxuan I have just pushed release 11.0.0-20240801-1
- can you please test if that solves the issue, and reopen the ticket if it is still an issue?
@davidmc24 do you know if there is an easy way to get the separator for the current language?
Since it also seems to be a problem with other language 🙂
No, I don't think there's a way to get that. I think we could avoid the issue by instead iterating through each of the possible source labels (G["BATTLE_PET_SOURCE_" .. i]) and checking if it's included in the string. That way, no dependency on the particular text/format of the string, and at worst would result in no match, which we could default to an "other" category or something.
@davidmc24 that would be nice, thank you 🙂