如何在除 Localizable.strings 之外的 Xcode 中创建多个 .strings 文件
How to create multiple .strings file in Xcode other than Localizable.strings
有时,该应用程序包含大量文本,Localizable.strings 似乎充斥着太多字符串,这让我很难找到要编辑的正确字符串(即使我为字符串添加了注释) .
我想创建多个 .strings 并将每个 .strings 文件设置为应用程序的相应功能或故事板集。
我尝试将 Localizable.strings 的文件名更改为 TestOnly.strings 等其他名称,但 Xcode 似乎没有读取每个可用的 .strings 文件,我找不到构建设置下的单个设置告诉 Xcode 读取 Localizable.strings 下的字符串。这是默认且不可更改的吗?
请注意,我不是在询问如何本地化字符串以支持不同的语言。我想要的就像我的 Localizable.strings 包含
"test_string" = "This is a test";
"test_string2" = "Another test";
然后我想 "test_string2" 放在另一个 .strings 文件中,比如 OtherLocalizable.strings 仍然可以被 Xcode 识别。
希望你们明白我的意思。
在 Xcode、File -> New -> File... 中,滚动到 Resource 组,select 字符串文件
通过 NSLocalizedStringFromTable(@"yourString", @"File", nil)
读取您的字符串
有时,该应用程序包含大量文本,Localizable.strings 似乎充斥着太多字符串,这让我很难找到要编辑的正确字符串(即使我为字符串添加了注释) .
我想创建多个 .strings 并将每个 .strings 文件设置为应用程序的相应功能或故事板集。
我尝试将 Localizable.strings 的文件名更改为 TestOnly.strings 等其他名称,但 Xcode 似乎没有读取每个可用的 .strings 文件,我找不到构建设置下的单个设置告诉 Xcode 读取 Localizable.strings 下的字符串。这是默认且不可更改的吗?
请注意,我不是在询问如何本地化字符串以支持不同的语言。我想要的就像我的 Localizable.strings 包含
"test_string" = "This is a test"; "test_string2" = "Another test";
然后我想 "test_string2" 放在另一个 .strings 文件中,比如 OtherLocalizable.strings 仍然可以被 Xcode 识别。
希望你们明白我的意思。
在 Xcode、File -> New -> File... 中,滚动到 Resource 组,select 字符串文件
通过 NSLocalizedStringFromTable(@"yourString", @"File", nil)