CMake generates an xcode project with localization

We are developing our OSX project using cMake as a tool to create an Xcode project.

However, it turns out that we need some localization, for which we need both English and German .xib files (or .strings to create them, and not an important bit).

We have the files in the right place and created correctly, but when cMake generates the project, the files are inserted into the Xcode project as two completely independent and independent files, for example:

Foo.xib foo.xib

Instead of two "subfiles" under the same name:

Foo.xib - Foo.xib (English) - Foo.xib (German)

If I drag xib, which are in en.lproj and sv.lproj, directly into the resources folder in the project explorer: Xcode automatically determines that these are several different languages ​​of the same interface, so languages ​​are automatically added to the project settings. Also, xibs get the MainMenu.xib group in Project Explorer three, which consists of both languages.

I am trying to add a localized xib to a project via cmake. They are added to the resource folder, but not as identified localizations, I get only two xibs in the project explorer, three without localization are not interconnected.

How can I make localization work through cmake generation?

set(CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS_MACOSX mac/en.lproj/MainMenu.xib ) set(CEFCLIENT_RESOURCES_MAC_SWEDISH_LPROJ_SRCS_MACOSX mac/sv.lproj/MainMenu.xib ) set(CEFCLIENT_RESOURCES_SRCS ${CEFCLIENT_RESOURCES_MAC_SRCS} ${CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS} ${CEFCLIENT_RESOURCES_MAC_SWEDISH_LPROJ_SRCS} ${CEFCLIENT_RESOURCES_RES_SRCS} ) 

Is there a way to generate Xcode projects via cmake with working .lproj packages?

+6
source share
1 answer

We just did it ourselves. Unfortunately, the solution is not very beautiful. I ended up writing my own python script using mod_pbxproj to modify the xcode project after smake generated it. If you manage to use a regular xcode project instead of the cmake created, I think you're better off. What do you need to do to make Xcode recognize a set of files, since localization is quite complicated.

+2
source

Source: https://habr.com/ru/post/984849/


All Articles