効果がありません。しかし、このコードをすべて使用すると、Hello World
メッセージが翻訳されません。使用gettextのは、私はgettextのとローカル・カタログリポジトリ用<a href="http://www.async.com.br/~kiko/gettext.html" rel="nofollow">following an official i8n example</a>午前
2
A
答えて
0
あなたが設定されたロケールが有効であることを確認する必要があります - あなたはsetlocale
で有効なロケールを設定しない場合は、glibcのは、あなたがC
またはPOSIX
ロケールで実行していると仮定して、指定された値を無視しますbindtextdomain
にあり、単純に非局所化された値を返します。これはgettextのやや非公式の動作です。
単純にpt_PT
の代わりに、pt_PT.UTF-8
にロケールを設定することをお勧めします。私の場合は
、私が試したとき、私が得た:
char *from_setlocale = setlocale(LC_ALL, "pt_PT");
char *checked_setlocale = setlocale(LC_ALL, NULL);
std::cout << (from_setlocale ? from_setlocale : "NULL") << std::endl << (checked_setlocale ? checked_setlocale : "NULL") << std::endl;
を私はポルトガル語ロケールがインストールされていないためです。私は、私がインストールされているロケール(en_IE.UTF-8
)を設定すると、私はいくつかの有用な出力を得る:
char *from_setlocale = setlocale(LC_ALL, "en_IE.UTF-8");
char *checked_setlocale = setlocale(LC_ALL, NULL);
std::cout << (from_setlocale ? from_setlocale : "NULL") << std::endl << (checked_setlocale ? checked_setlocale : "NULL") << std::endl;
しかも
は、私が生成されたメッセージファイルからローカライズされた値を取得します。関連する問題
- 1. 私はドキュメント<a href="https://cloud.google.com/speech/docs/common/auth#set_up_a_service_account" rel="nofollow noreferrer">here</a>を、次の午前
- 2. でgettextを使用する<%= link ..%>
- 3. getText()を使用したNullPointerException
- 4. 反応-Reduxのフォームをディスパッチは、私は<a href="https://davidkpiano.github.io/react-redux-form/" rel="nofollow noreferrer">react-redux-forms</a>を使用して<a href="https://davidkpiano.github.io/react-redux-form/docs/guides/quickstart.html" rel="nofollow noreferrer">quick start</a>を、次の午前小道具
- 5. <a href=url rel='noreferrer'> in the success of an ajax request
- 6. getText()。toString()vs(String)getText()
- 7. マングース。 <a href="http://mongoosejs.com/docs/embedded-documents.html" rel="nofollow">a official mongoose site</a>では、アレイ
- 8. 私は<a href="http://droidparts.org/widgets.html#clearableedittext" rel="nofollow noreferrer">Droidparts official doc</a>に述べたようにClearableEditTextを使用しようとしている
- 9. リストビューでのgettextの使用方法
- 10. gettextプレースホルダの使い方は?
- 11. GetTextはは()のEditText
- 12. はJQueryの.html()私は<a href="http://onsen.io" rel="nofollow noreferrer">Onsen UI</a> + jQueryのを使用してい
- 13. :<a href="http://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html#the-springstandard-dialect" rel="nofollow noreferrer">thymeleaf official docs</a>では各タグ
- 14. gettextのはcygwinの
- 15. Win32でのGNU gettextの使用
- 16. Djangoのgettextのは
- 17. 私は* <a href="http://python.codnex.net/index.php" rel="nofollow noreferrer">http://python.codnex.net/index.php</a> *を使用しているのpython
- 18. fullpagejsは - 私は<a href="https://github.com/alvarotrigo/fullPage.js#fullpagejs" rel="nofollow noreferrer">fullpagejs</a>を使用しているテンプレート
- 19. のgetText()
- 20. ::のgetText
- 21. が<a href="https://developers.google.com/awareness" rel="nofollow">official documentation</a>からの案内に従い、Googleの啓発API
- 22. は、Java用<a href="http://www.magnolia-cms.com/" rel="nofollow">MAGNOLIA</a></p> <p>CMSを使用する
- 23. このコマンドで起動し、私は<a href="https://hub.docker.com/_/mysql/" rel="nofollow noreferrer">mysql image</a>を使用
- 24. ウィキデータ:SPARQL、私は<a href="https://query.wikidata.org/" rel="nofollow noreferrer">https://query.wikidata.org/</a>でこのクエリを使用し
- 25. は、私はこの<a href="https://code.visualstudio.com/tutorials/nodejs-deployment/deploy-website" rel="nofollow noreferrer">article</a>を、次の午前AzureのWebサイト
- 26. gettextの別名と
- 27. 私は<strong><a href="https://github.com/carhartl/jquery-cookie" rel="nofollow">jquery cookie</a></strong>プラグインを使用して、ここに私のコードです名前
- 28. gettextは/ anまたはd '/ deをどのように扱いますか?
- 29. NDKを使用できないのは何ですか? <a href="http://developer.android.com/sdk/ndk/index.html" rel="nofollow">official NDK site</a>から
- 30. Pythonとgettext
ようこそStackOverflow!あなたの 'messages.mo'ファイルの内容を意味するように、すべての情報を含めてください。*(例のために" Hello World! "にトリムダウンする必要があります)*。また、呼び出しの戻り値が何であるかを確認すると役に立つかもしれません... bindtextdomainはディレクトリやNULLの 'char * 'へのポインタを返すかもしれないことに注意してください。問題があれば 'errno'を返します。 – HostileFork