Localizing the Edit menu and other standard menus
Update:
Thanks to this helpful post by Douglas Hill I've learned there is actually a proper solution to this. Apple maintains a list of Glossaries that include strings for a huge number of uses. They're designed for a command line tool named AppleGlot, but they can also be opened in a text editor. Apple's Internationalization page includes links to these tools. Localizing Strings Files Using AppleGlot includes some information on how to use AppleGlot—though currently the app's installer has an expired certificate, and it doesn't appear to be compatible with Catalina regardless. Douglas Hill's post offers some alternative ideas for how to automate the translation process.
Original Answer:
From what I can tell, there really is no easy way to do this. For Japanese in particular, I ended up using a process like this:
In Finder, right-click on an existing app, like TextEdit, and choose "Show Package Contents"
Inside the package, go to Contents/Resources and you'll see the localization folders like en.lproj and Japanese.lproj
Inside those folders, you'll see the NIB files. Using a plain text edit (like BBEdit), open the main NIB file for your main language and the language you want translations for. In many cases the files you want will be named MainMenu.nib. With TextEdit, the files are named Edit.nib. The files are XML, so they're clearly structured, but there's a lot of stuff you don't care about. Having the two files open makes it easier.
In the English file, you can search for something like "Check Document Now". Directly below that is the keyboard shortcut (;) and the method the menu item calls (
checkSpelling:
). Now you can search the Japanese file for checkSpelling and the translation you need is right above it. It sounds tedious, but I've found it pretty quick for the most part, especially since you rarely need to type everything out fully to find what you need. Many of the method names are obvious too—likecut:
paste:
copy:
and so on, so as you go you may be able to skip checking the English file first.Menu items that are submenus are a bit trickier, since the method will just be
submenuAction:
. You can use the surrounding XML to help verify you're looking at the same thing in both NIBs, or you can check in the app itself to make sure you're looking at the right text. Google Translate was also helpful when I wanted to make sure I copied the right thing. You might even try using Google Translate first, and just verify that it matches what Apple uses.
Obviously you need to either be very careful, or have someone who speaks the language verify everything works as expected. It'd be better to just have a translator do all the work. In my case, I've had people volunteer to do translations, and all the text unique to my app is already translated. I didn't want to bother them with the tedious work of translating a bunch of text someone else has already translated.
Localized Nibs contains MainMenu.nib files, with the menubars pre-localized into various languages. All items are connected to the proper actions, and several additional resources are included (such as flag graphics, ISO language tables, and more).
localize-mainmenu - Command line tool that localizes the common main menu items of an OS X app automatically.
I found Martin Stemmel's git project useful (FYI: I have connection to the author). It is free and you can simply browse the various language files for the standard main menu strings u need or use the project.
https://github.com/martnst/localize-mainmenu