如何在 Xcode 中创建多个 .strings 文件而不是 Localizable.strings

fin*_*tic 4 xcode localizable.strings ios

有时,该应用程序包含大量文本,而 Localizable.strings 似乎充斥着过多的字符串,这让我很难找到要编辑的正确字符串(即使我为这些字符串添加了注释)。

我想创建多个 .strings 并将每个 .strings 文件设置为应用程序的相应功能或故事板集。

我尝试将 Localizable.strings 的文件名更改为 TestOnly.strings 等其他名称,但 Xcode 似乎并没有读取每个可用的 .strings 文件,而且我在构建设置下找不到告诉 Xcode 读取字符串的单个设置Localizable.strings。这是默认的且不可更改的吗?

请注意,我不是在问如何本地化字符串以支持不同的语言。我想要的是例如我的 Localizable.strings 包含

"test_string" = "这是一个测试"; "test_string2" = "另一个测试";

然后我希望将“test_string2”放置在另一个 .strings 文件中,例如 OtherLocalizable.strings 仍然可以被 Xcode 识别。

我希望你们明白我的意思。

tom*_*wel 6

在 Xcode 中,File -> New -> File...,滚动到Resource组,选择String File

创建字符串文件

本地化

项目中的字符串文件

读取你的字符串 NSLocalizedStringFromTable(@"yourString", @"File", nil)

  • 您好,抱歉没有仔细阅读您的回答。这正是我需要的 (2认同)