0

我正在尝试解析一个 x-code 项目来翻译它。

我有 3 或 4 个大型应用程序要翻译,所以我启动了一个 C# 项目来执行此操作。

我在使用正则表达式时遇到了很大的麻烦。

有谁知道如何提取这样的字符串:

要解析的字符串:

title = [[Object alloc] initWithTitle:@"My Title" andParam:@"A complex \"param\"" andAFormat:@"Hello %@",toto];

结果应该像一个数组:

ObjC "My Title", "A complex \"param\"", "Hello %@"

我对这个很迷茫......

谢谢你。

4

1 回答 1

0

If you're trying to translate a set of strings within a project, then I'd strongly recommend converting all string instances such as @"My Title" to the localizable macro:

NSLocalizedString(@"My Title", @"Comment which will appear above My Title, such as ObjC \"My Title\"");

These can then be extracted using the genstrings command line utility, which will generate a strings file with entries like:

/* Comment which will appear above My Title, such as ObjC "My Title" */ @"My Title" = @"My Title";

This means that integrating the translated strings back into your project becomes very simple.

The native way to approach localizing strings within your application is documented here:

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html

于 2013-04-25T15:46:55.347 回答