我想爲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. WPF App Support Locale without Localization
- 2. 如何使用Automake將gettext mo文件安裝到/ usr/share/locale?
- 3. 在Perl中使用gettext和Locale :: TextDomain進行本地化,如果Locale :: TextDomain不可用
- 4. Gettext,不顯示
- 5. Gettext不工作
- 6. Gettext php,主意?
- 7. 設置gettext問題()
- 8. Zend Navigation和Zend Locale
- 9. gettext設置不起作用
- 10. gettext問題php
- 11. Magento Locale/Timezone Issue
- 12. boost :: locale icu sortKey
- 13. psutil/subprocess return process code when process killed
- 14. Process :: detach和Process :: wait互斥(Ruby)?
- 15. gettext沒有翻譯顯示
- 16. 如何調試php gettext?
- 17. sprintf的枝杈Gettext的
- 18. 在Ubuntu上無法獲取gettext(php)
- 19. PHP gettext不翻譯
- 20. Bootstrap Datepicker Locale with MomentJS
- 21. Before_validation:set_locale vs I18n.t(text:...,locale:)
- 22. ANDROID APPLICATION AND PROCESS
- 23. Process Synchronisation- TestAndSetLock
- 24. vb.net process start&stop
- 25. linux show process duration
- 26. python process._sbootstrap()/ .start()
- 27. Ptracing Process Trees
- 28. docker per process routing
- 29. Golang fork process
- 30. unix process infinite