プロジェクトで i18n のソリューションとして jed.js を使用しようとしています。
Jed コンストラクターに渡されるオプションを理解できません。
ドキュメントには、ドメインと locale_data オブジェクトを渡す必要があると書かれています。ただし、locale_data には、ドメイン値を持つ別のキーがあります。また、その下には、別のドメイン キーとドメインを値として持つ空のキー (つまり "") があります。
ドキュメントからの抜粋は次のとおりです。
var i18n = new Jed({
// You can choose to set the domain at instantiation time
// If you don't, then "messages" will be used by default
"domain" : "the_domain",
// This is the translation data, which is often generated by
// a po2json converter. You would ideally have one per locale
// and only pull in the locale_data that you need.
"locale_data" : {
// This is the domain key
"the_domain" : {
// The empty string key is used as the configuration
// block for each domain
"" : {
// Domain name
"domain" : "the_domain"
}
}
}
});
- ドメインの意味は何ですか? また、ドメインが何度も繰り返されるのはなぜですか?
- ドメインごとに新しい Jed インスタンスが必要ですか?
- ドメインは言語とどのように関係していますか?