没有Main.storyboard的Xcode Base国际化

时间:2021-12-09 19:41:13

I'm trying to follow the tips in Apple's I18N and L10N Guide. I have a pre-existing project from which I have (long ago) deleted the Base.lproj folder. Why? Because I have no Main.storyboard or LaunchScreen.xib. Both of those things are handled programmatically.

我正在尝试按照Apple的I18N和L10N指南中的提示进行操作。我有一个预先存在的项目,我(很久以前)已经删除了Base.lproj文件夹。为什么?因为我没有Main.storyboard或LaunchScreen.xib。这两件事都是以编程方式处理的。

However I do have a large number of subsidiary storyboards, including a WatchKit Interface.storyboard. When I click the + in the Project (not target) Localizations section, Xcode presents a dialog that lists only the Interface.storyboard file. Not any of the many others.

但是我确实有大量的辅助故事板,包括WatchKit Interface.storyboard。当我单击Project(非目标)Localizations部分中的+时,Xcode会显示一个仅列出Interface.storyboard文件的对话框。不是其他任何一个。

How can I persuade Xcode to help me localize the other storyboards? Can I do this all manually? As usual, I am sure it is my mental model that needs refinement.

我如何说服Xcode帮助我本地化其他故事板?我可以手动完成吗?像往常一样,我确信这是我的心理模型需要改进。

1 个解决方案

#1


This is an example where configuration yields convention. That is, if you customize your folder hierarchy, Xcode can adapt and implement its naming conventions.

这是配置产生约定的示例。也就是说,如果您自定义文件夹层次结构,Xcode可以调整并实现其命名约定。

  1. Select storyboard file in left pane (Project navigator)
  2. 在左窗格中选择故事板文件(项目导航器)

  3. Click Doc icon (File inspector) in right pane
  4. 单击右窗格中的“文档”图标(“文件检查器”)

  5. Click Localize...

This will create a new Base.proj folder inside whatever folder holds the storyboard. If you are like me, you have done lots of folder-factoring. Xcode goes along with this.

这将在包含故事板的任何文件夹内创建一个新的Base.proj文件夹。如果你像我一样,你已经做了很多文件夹因素。 Xcode与此同步。

Then you go back to the Project Localizations section and click + to add locales. Xcode creates extracts the strings from your storyboard and creates new folders for the corresponding .strings files.

然后,返回“项目本地化”部分,然后单击“+”以添加区域设置。 Xcode创建从故事板中提取字符串,并为相应的.strings文件创建新文件夹。

#1


This is an example where configuration yields convention. That is, if you customize your folder hierarchy, Xcode can adapt and implement its naming conventions.

这是配置产生约定的示例。也就是说,如果您自定义文件夹层次结构,Xcode可以调整并实现其命名约定。

  1. Select storyboard file in left pane (Project navigator)
  2. 在左窗格中选择故事板文件(项目导航器)

  3. Click Doc icon (File inspector) in right pane
  4. 单击右窗格中的“文档”图标(“文件检查器”)

  5. Click Localize...

This will create a new Base.proj folder inside whatever folder holds the storyboard. If you are like me, you have done lots of folder-factoring. Xcode goes along with this.

这将在包含故事板的任何文件夹内创建一个新的Base.proj文件夹。如果你像我一样,你已经做了很多文件夹因素。 Xcode与此同步。

Then you go back to the Project Localizations section and click + to add locales. Xcode creates extracts the strings from your storyboard and creates new folders for the corresponding .strings files.

然后,返回“项目本地化”部分,然后单击“+”以添加区域设置。 Xcode创建从故事板中提取字符串,并为相应的.strings文件创建新文件夹。