Closed khaledhosny closed 8 months ago
There are two ways to do it. Put the localized strings into the code:
title = Glyphs.localize({
'en': "Show MATH Italic Correction",
'de': "Zeige MATH Italic Verbindung"
})
menuItem = self.newMenuItem_(title, self.toggleShowIC_)
That is fine for a smaller number of strings and keys.
Or use Localizable.strings
files and NSBundle to pick the right string.
NSLocalizedString("Show MATH Italic Correction", "")
(or make a shortcut like NSLoc()
)
A Localizable.stringsfile is put in a folder
en.lproj`de.lproj
and ar.lproj
(check the Glyphs bundle for available languages).
"Show MATH Italic Correction" = "Zeige MATH Italic Verbindung";
That setup is a bit more involved but easier to maintain. And has less clutter in the code.
What way do you prefer. I can help set it up.
Thanks Georg, I appreciate your help. The second approach seems cleaner, so I’d go with that.
You can have a look at one of my plugins for the .strings table files and the use of those strings in code.
My code is in Objective-C, but the idea is the same with Python and pyobjc.
I just pushed a german localization. That includes the setup and some tooling to keep it updated.
Thanks George, that is wonderful. I’ll see if I can add Arabic localization.
Provide at least Arabic localization in addition to English.