简体   繁体   English

是否可以在静态链接的lib内部实现字符串本地化?

[英]Is it possible to achieve string localization inside of a statically linked lib?

I am working on building an SDK which will be built out as a statically linked library that third party applications can then drop in to their applications. 我正在构建一个SDK,该SDK将作为静态链接库构建,第三方应用程序然后可以将其放入其应用程序中。 Inside of this SDK, I was looking to be able to perform some "localization." 在此SDK的内部,我希望能够执行一些“本地化”。 Basically, I would like for the code in my SDK to be able to access some ".string" files to perform some string lookup and language translation capabilities. 基本上,我希望我的SDK中的代码能够访问一些“ .string”文件以执行某些字符串查找和语言翻译功能。 Then I could propagate these strings outward to implementing App layers through my exposed API's. 然后,我可以通过暴露的API将这些字符串向外传播到实现App层。 Is this even possible? 这有可能吗? I thought it was but now that I have actually been trying, I am seriously having doubts. 我以为是,但是现在我实际上已经在尝试,我对此深有怀疑。

You can make specific API to make the localized strings to be fed into the static library. 您可以创建特定的API,以将本地化的字符串输入到静态库中。 One way for achieving it is by defining a predefined key value pair for all your library strings and ask end user to provide a localized files if a new language needs to be supported. 实现此目的的一种方法是为所有库字符串定义预定义的键值对,并要求最终用户提供本地化文件,以了解是否需要支持新语言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM