SDK 1.9.3, Windows 11
I'm working on infrastructure, this time on menus and such (work based on the gridview list example). So far, so good. So then I want to fold in some i18n (internationalization), looking to add a menu item to switch from English to Japanese... logical first step there is to move my hardcoded English strings to looking up something from 'en.strings' and switch calling the 'drawLocalizedxxxx' functions.
Every time I try to use the 'drawLocalized' functions I get a font related error: "CoreLibs/graphics.lua:282: method 'getLeading' is not callable (a nil value)"
I know the key lookup is successful, because I swapped in something that wouldn't be successful and got complaints about it rather than the graphics.lua error .
I think the 'drawLocalized' syntax is correct as I'm just adding the language string ("en") to the method signature, and the docs say that moving from this:
playdate.graphics.drawTextInRect(text, x, y, width, height, [leadingAdjustment, [truncationString, [alignment, [font]]]])
(where the optional font isn't specified)
playdate.graphics.drawLocalizedTextInRect(text, x, y, width, height, [leadingAdjustment, [truncationString, [alignment, [language]]]])
(and the 'en.strings' lookup is happening/successful as there is no complaint)
I've reproduced the issue using a modification of the 'Game Template' example (attached). Working:
Switched to calling the localization equivalent, not working:
(the 'SetupDiGetDeviceRegistryProperty' stuff I'm pretty sure is unrelated and is instead due to setting the Simulator executable properties to high definition scaling to sync with my main monitor)
The way I build/run the reproduction (Windows batch file):
@echo off pdc "Game Template/Source" gt.pdx playdatesimulator gt.pdx
Game Template.zip (6.1 KB)