我想爲i18n使用gettext。但我需要翻譯messeges到不同的語言。是否可以爲一個gettext調用指定一個語言環境?Gettext without process locale
1
A
回答
0
正如你可以從Replacements for gettext看到的 我有類似的問題,只有它變得更糟,如果你必須支持更多的平臺。
基本上gettext只適用於單線程交互式程序。
如果您有機會,那麼不同的翻譯系統(ICU看起來相當不錯)。
否則有讀取直接的.mo文件,並根據需要可以提供翻譯一些庫:
0
我想要使用gettext的國際化。但我需要翻譯messeges到不同的語言。
如果您的應用程序是單線程的,你可以切換語言環境,否則你無法使用 gettext庫用於這一目的。
是否可以爲一個gettext調用指定一個語言環境?
您可以使用支持gettext消息目錄的非官方Boost庫Boost.Locale。但它只是C++
。
1
如果您使用多個線程,那麼如果使用POSIX.1-2008中指定的語言環境相關設施(並在GLIBC 2.3中實現),則可以使用gettext。您可以使用的關鍵功能是uselocale
,它有點像setlocale
,但僅適用於當前線程。
如果您使用的是Windows,那麼你的運氣了 - MSVCRT並不uselocale
提供等效的,我相信在這個平臺的libintl模擬setlocale
本身,在非線程安全的方式IIRC。
相關問題
- 1. gettext和locale
- 2. php twig multilanguage without gettext
- 3. WPF App Support Locale without Localization
- 4. 如何使用Automake將gettext mo文件安裝到/ usr/share/locale?
- 5. 在Perl中使用gettext和Locale :: TextDomain進行本地化,如果Locale :: TextDomain不可用
- 6. Java Process Process OutOfMemoryException
- 7. Gettext,不顯示
- 8. Gettext不翻譯
- 9. Gettext不工作
- 10. Gettext php,主意?
- 11. ASP.NET | Process Class- Runing And Stoping Process
- 12. 設置gettext問題()
- 13. Zend Navigation和Zend Locale
- 14. 爲什麼ResourceBundle.getBundle(String,Locale)忽略Locale?
- 15. gettext設置不起作用
- 16. 使用gettext的
- 17. gettext問題php
- 18. PHP Gettext的不工作
- 19. boost :: locale icu sortKey
- 20. GameCenter match by locale
- 21. Magento Locale/Timezone Issue
- 22. osx locale bug?
- 23. 提升locale iequals?
- 24. StandardOutput Process
- 25. PHP的gettext不起作用
- 26. Process :: detach和Process :: wait互斥(Ruby)?
- 27. psutil/subprocess return process code when process killed
- 28. gettext沒有翻譯顯示
- 29. php Gettext在Windows路徑
- 30. 如何調試php gettext?