Are your templates/documents bundles/packages? If so, you can localize the CFBundleDisplayName key from the Info.plist by using Infoplist.strings file.
Our documents are file bundles. Unfortunatley, I've been unable get this working. Do you have any other information or a pointer to some documentation on how to set this up properly?
Here's what I did. I tried to mimic the structure of the app bundle. For example, I set up one of our template bundle files for German like so (each additional locale would get its own lproj directory and InfoPlist.strings):
----InfoPlist.strings. (strings file with "CFBundleDisplayName" = "Some German";)
I gather my URLs as follows:
let mgr = FileManager.default let templatesURL = Bundle.main.resourceURL!.appendingPathComponent("Templates") templateURLs = try! mgr.contentsOfDirectory(at: templatesURL, includingPropertiesForKeys: [.localizedNameKey], options: )
Checking in the debugger with po templateURLs.resourceValues(forKeys: [.localizedNameKey]) shows only the English name.
I am not 100% sure about what should or shouldn't be included in the Info.plist. I've set it up as follows:
CFBundleDevelopmentRegion en CFBundleDisplayName Template Bundle CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType APPL CFBundleIdentifier com.mycompany.templatebundle CFBundleName templatebundle CFBundleSignature ????
When you say po shows only the English name, I assume you mean even when the system language is set to German.
What is the name of the template bundle in the file system? Or, put another way, what is the lastPathComponent of the URL? I don't really know about iOS, but I know that on macOS, the localized display name is only used if the file name (minus extension) matches the unlocalized display name in the Info.plist. That's so that if the user renames the bundle, their renaming overrides any localization stuff. (Doesn't necessarily apply to templates, but is for the general case.)
Hey Ken, thank you so much for your help.
You are correct about the language setting. I've tried both setting the scheme "Application Language" option to German and just in case that had an issue, I set my iPad system language to German to be 100% sure that I was testing in German.
I made an error in the directory structure I showed in my previous reply. To closer matach what I really have on my file system, TemplateBundle should be
and in the plist I have the CFBundleDisplayName as shown in the plist above (so that the URL's lastPathComponent (minus the extension) indeed matches the unlocalized CFBundleDisplayName).
You're welcome, but I'm afraid I'm stumped. Maybe file bundle localization doesn't work like I thought on iOS. Or maybe somebody else can off help.