I've gone trough my source files and updated all my strings using the NSLocalizedString() macro. Now because I have a lot of strings that come up across multiple source files , I decided to place a large amount of the strings in a header file called "LocalizedStringDefinitions.h" using the #define directive. So for example each line looks like this,
我已经通过我的源文件,并使用NSLocalizedString()宏更新了我的所有字符串。现在因为我有很多字符串出现在多个源文件中,所以我决定使用#define指令将大量字符串放在名为“LocalizedStringDefinitions.h”的头文件中。例如,每条线看起来像这样,
#define kLocalizedSTRINGNAME NSLocalizedString(@"STRINGNAME", @"Comment")
I just ran the genstrings command in terminal and the Localizable.strings file that was created contained only the localized strings that were directly placed in my code and none of the #defined ones. I have around 100 lines of #defined strings which I do not want to place back in my code especially because they appear across multiple files. How can I localize the strings?
我刚刚在终端中运行了genstrings命令,并且创建的Localizable.strings文件只包含直接放在我的代码中的本地化字符串而没有#defined的字符串。我有大约100行#defined字符串,我不想放回到我的代码中,特别是因为它们出现在多个文件中。我如何本地化字符串?
1 个解决方案
#1
6
I just realized how simple this is. If you look a the Terminal command genstrings *.m
the .m part is clearly specifying to look through the implementation files. The file with the #define's is a header file (.h) so by using the command genstrings *.h
I was able to generate the .strings file, or I could just change the name of the file with the definitions to "LocalizableStringDefinitions.m"
我刚才意识到这很简单。如果您查看终端命令genstrings * .m,.m部分明确指定查看实现文件。带有#define的文件是一个头文件(.h),所以通过使用命令genstrings * .h,我能够生成.strings文件,或者我可以只用“LocalizableStringDefinitions”的定义更改文件名。 M”
#1
6
I just realized how simple this is. If you look a the Terminal command genstrings *.m
the .m part is clearly specifying to look through the implementation files. The file with the #define's is a header file (.h) so by using the command genstrings *.h
I was able to generate the .strings file, or I could just change the name of the file with the definitions to "LocalizableStringDefinitions.m"
我刚才意识到这很简单。如果您查看终端命令genstrings * .m,.m部分明确指定查看实现文件。带有#define的文件是一个头文件(.h),所以通过使用命令genstrings * .h,我能够生成.strings文件,或者我可以只用“LocalizableStringDefinitions”的定义更改文件名。 M”