2.6.0: incorrect language constants

,

With SDK 2.6.0 on Windows and Linux, the values of constants playdate.graphics.font.kLanguageEnglish and playdate.graphics.font.kLanguageJapanese appear to be incorrect on the Lua side, and inconsistent with playdate.GetSystemLanguage(), which should return one of the two (in my case kLanguageEnglish).

This trivial script:

import "CoreLibs/graphics"

print("GetSystemLanguage(): " .. playdate.getSystemLanguage())
print("kLanguageEnglish: " .. playdate.graphics.font.kLanguageEnglish)
print("kLanguageJapanese: " .. playdate.graphics.font.kLanguageJapanese)

prints in the simulator console:

GetSystemLanguage(): 0
kLanguageEnglish: 50331648
kLanguageJapanese: 50331649

0 and 1 are the values I would expect to see for the two constants.

Edit: on the C side things look as expected. Maybe something gets shifted incorrectly by the time it gets to the Lua runtime?

So, it turns out one of the season games had code assuming that the english constant is 0 and the japanese 1, so this change broke the game. I'll revert that and figure out how to make the drawLocalizedText() function work without it, if I can

1 Like

Was the season game Demon Quest '85? There have been reports on Reddit of the game crashing on firmware 2.6.0 when starting a new game.

That's the one! I've got a fix in now, not too messy but now if you want to specify the language in gfx.drawLocalizedText you either have to use the string version ("en", etc) or also include the leading adjustment--otherwise there's no way to tell whether that argument is for the language or the leading. But since we don't actually have UI for setting the system language yet, it seems unlikely anyone's using that function. :confused: I think we'll probably change things around there when we do add multilanguage support (soon, I hope!)

1 Like

But since we don't actually have UI for setting the system language yet, it seems unlikely anyone's using that function. :confused:

Agents of Groove uses the localization functions pretty extensively (and that's how I ran into this), but since it hasn't shipped yet I can still change this around and work around other possible issues. Hopefully there won't be too many breaking changes down the line, I think I'll go ahead and make another overhauling pass to try and get ahead of this type of things as much as possible.

3 Likes

Confirmed fixed in 2.6.1:

GetSystemLanguage(): 0
kLanguageEnglish: 0
kLanguageJapanese: 1

Though if there was a change for drawLocalizedText, it didn't make the changelog nor the documentation.

1 Like