Open djbe opened 4 years ago
From my understanding, according to the implementation of #70, those files must also be in Base.lproj
directory. PBXVariantGroup
s are created based on files sit in Base.lproj
.
From Apple's own docs, they recommend to not add Localizable.strings (and such) to Base.lproj
:
Add the file to your Xcode project, as described in Adding Languages. Don’t add Localizable.strings to the Base localization when the dialog appears.
So for interface builder files (storyboard, xib, nib) that are localised, the interface file should be in Base.lproj
and the translation files (strings) in the corresponding language .lproj
. For simple strings files such as Localizable.strings
, InfoPlist.strings
and others, they don't need to be in Base.lproj
.
Note that you can have strings files in Base.lproj
, but it is not required or expected by Xcode and other tooling.
Yeah I think so too. I just noted the current situation. This should be a valuable improvement/fix.
@djbe Title could be changed to "Localized .strings resources are not detected correctly"
Any info or workaround on this issues?
Hi all. This project grew out of my own needs, and I've never had any complicated localization requirements. I've always treated base as english (which would be the workaround here I believe). Other contributors have added code over the years around localization. This fix would require changes around here https://github.com/yonaskolb/XcodeGen/blob/master/Sources/XcodeGenKit/SourceGenerator.swift#L460 Would welcome any PR's here, if they came with tests. That file has become a bit unwieldy over the years, and could do with some refactoring.
Hi all, I think that I have the same issue.
Any info or workaround on this issues?
Came up with a kind of solution. Since we don't use Interface Builder in our project there is a workaround to disable Base Internationalization entirely using useBaseInternationalization: false
. With that option enabled .strings
and .stringdict
files in en.lproj were detected correctly.
https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#options
Came up with a kind of solution. Since we don't use Interface Builder in our project there is a workaround to disable Base Internationalization entirely using
useBaseInternationalization: false
. With that option enabled.strings
and.stringdict
files in en.lproj were detected correctly. https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#options
Succeeded after deleting Base.lproj
, 😀
@djbe I had a very similar project structure to you. I found a workaround that isn't great but might help some folks.
I added an empty Localizable.strings
directory inside of Base.lproj
and Xcode then picked up all the strings files elsewhere. It then seems to generate the appropriate PBXVariantGroup
children for each locale.
So if you had:
Application
- Resources
- Base.lproj
- Authentication.storyboard
- ... (only .storyboard files)
- en.lproj
- Authentication.strings
- ... (other .strings files for storyboards)
- InfoPlist.strings
- Localizable.strings
- Localizable.stringsdict
I did this:
Application
- Resources
- Base.lproj
- Localizable.strings/
- Authentication.storyboard
- ... (only .storyboard files)
- en.lproj
- Authentication.strings
- ... (other .strings files for storyboards)
- InfoPlist.strings
- Localizable.strings
- Localizable.stringsdict
Note that empty directories obviously aren't indexed by git so if you (or seeing as 4 years have gone by, I imagine someone else reading this) decide go with this approach then stick a file in the directory.
Overall, this is obviously vulnerable to the implementation changing. So a proper fix here is still needed at some point.
I seem to be hitting the exact same issue as #80, namely that my
Localizable.strings(dict)
files (andInfoPlist.strings
files) are not detected correctly and seen as loose files:As you can see, strings files for storyboards are seen correctly, whereas normal strings files are not seen as language variations of the same file.
The directory structure is correct though:
My project file (mostly, the relevant bits):
Also tried using XcodeGen in another project, same issue, which is worse there 'cause that project has +-10 languages.