I figured out that when I use getI18nString like this
self.commandRouter.pushToastMessage('failure', self.commandRouter.getI18nString('YOUTUBE_CONFIGURATION'), self.commandRouter.getI18nString('YOUTUBE_CONFIGURATION_SAVE_ERROR'));
that an empty message is shown. In my case getI18nString returns undefined but the resource keys definitely exist in i18n/strings_en.json. I used the same resource keys on my configuration page for testing purpose and there everything works as expected.
I had a look into the source code of the spotify and qobuz plugin but both don’t use localized strings when showing toast messages. The webradio plugin calls getI18nString the same way and there it works.
The documentation only explains how localization works for the configuration pages but not for things like toast messages.
Shouldn’t this code load the localization resources into a dictionary when volumio starts and then getI18nString should return the correct localized string?
Please tell me what I am doing wrong here. I really wish to localize my whole plugin and not just the configuration page.