-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the index.html to address the i18n issue #12
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8752035
Update the index.html to address the i18n issue
MichaelWangzitao 9e0cc4f
Update index.html
MichaelWangzitao a8c1bf9
Update index.html
MichaelWangzitao f485660
Update index.html
MichaelWangzitao 6aee4f0
Update index.html
MichaelWangzitao a92c964
Update index.html
MichaelWangzitao dfaf775
Update index.html
MichaelWangzitao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1104,8 +1104,13 @@ <h3><code>reason</code> member</h3> | |||||||||
|
||||||||||
<section> | ||||||||||
<h2> | ||||||||||
<span its-locale-filter-list="en" lang="en"><dfn>Localizable members</dfn></span> | ||||||||||
<span its-locale-filter-list="zh-hans" lang="zh-hans"><dfn>可本地化属性</dfn></span> | ||||||||||
<span its-locale-filter-list="en" lang="en">Internationalization</span> | ||||||||||
<span its-locale-filter-list="zh-hans" lang="zh-hans">国际化方案</span> | ||||||||||
</h2> | ||||||||||
<section> | ||||||||||
<h2> | ||||||||||
<span its-locale-filter-list="en" lang="en">Localizable members</span> | ||||||||||
<span its-locale-filter-list="zh-hans" lang="zh-hans">可本地化属性</span> | ||||||||||
</h2> | ||||||||||
<p its-locale-filter-list="en" lang="en"> | ||||||||||
The following members are localizable and share the same default configuration of <code>dir</code> and <code>lang</code> if not otherwise specified. | ||||||||||
|
@@ -1121,6 +1126,96 @@ <h2> | |||||||||
<li><a>MiniAppWidgetResource.name</a></li> | ||||||||||
</ul> | ||||||||||
</section> | ||||||||||
<section> | ||||||||||
<h2> | ||||||||||
<span its-locale-filter-list="en" lang="en">I18n Solution</span> | ||||||||||
<span its-locale-filter-list="zh-hans" lang="zh-hans">I18n方案</span> | ||||||||||
</h2> | ||||||||||
<p its-locale-filter-list="en" lang="en"> | ||||||||||
To support the multiple languages, attributes such as name, short_name, and description can be set as a reference to a string resource. Typically, string resources are stored in the corresponding multi-language JSON file in the MiniApp package's i18n directory. The multi-language file’s name complies with IETF BCP 47.</p> | ||||||||||
<p its-locale-filter-list="zh-hans" lang="zh-hans"> | ||||||||||
为了支持多语言能力name, short_name, description等参数可以被设置为字符串资源的索引。通常情况下字符串资源被保存在MiniApp包i18n目录下相应的多语言文件中。多语言文件命名规范符合IETF BCP 47。 | ||||||||||
</p> | ||||||||||
|
||||||||||
<p its-locale-filter-list="en" lang="en"> | ||||||||||
The following example describes two simple multi-language files: | ||||||||||
</p> | ||||||||||
<p its-locale-filter-list="zh-hans" lang="zh-hans"> | ||||||||||
以下例子描述2个简单的多语言文: | ||||||||||
</p> | ||||||||||
|
||||||||||
<p>i18n/en-US.json</p> | ||||||||||
</div> | ||||||||||
<pre class="example json"> | ||||||||||
{ | ||||||||||
"strings": { | ||||||||||
"name":"miniapp demo", | ||||||||||
"short_name":"MD", | ||||||||||
"description_application":"MiniApp Demo", | ||||||||||
}, | ||||||||||
"files": { | ||||||||||
"images":"image/en_picture.PNG", | ||||||||||
}, | ||||||||||
} | ||||||||||
</pre> | ||||||||||
|
||||||||||
<p>i18n/zh-Hans.json</p> | ||||||||||
</div> | ||||||||||
<pre class="example json"> | ||||||||||
Comment on lines
+1162
to
+1164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
{ | ||||||||||
"strings": { | ||||||||||
"name":"小程序试用版", | ||||||||||
"short_name":"小程序", | ||||||||||
"description_application":"迷你程序试用版本", | ||||||||||
}, | ||||||||||
"files": { | ||||||||||
"images":"image/zh_picture.PNG", | ||||||||||
}, | ||||||||||
} | ||||||||||
</pre> | ||||||||||
|
||||||||||
<p its-locale-filter-list="en" lang="en"> | ||||||||||
Developers can refer to a resource using the syntax $string:‹resource-name›, for example, "decscription": "$string:description_application". | ||||||||||
</p> | ||||||||||
<p its-locale-filter-list="zh-hans" lang="zh-hans"> | ||||||||||
用户可以使用$string:‹resource-name›的方式引用字符串资源,例如:"decscription": "$string:description_application". | ||||||||||
</p> | ||||||||||
|
||||||||||
<p its-locale-filter-list="en" lang="en"> | ||||||||||
The following example describes a simple manifest fragment that supports multiple languages capability: | ||||||||||
</p> | ||||||||||
<p its-locale-filter-list="zh-hans" lang="zh-hans"> | ||||||||||
以下例子描述一个简单的支持多语言的manifest片段: | ||||||||||
</p> | ||||||||||
|
||||||||||
<pre class="example json"> | ||||||||||
{ | ||||||||||
"dir": "ltr", | ||||||||||
"lang": "en-US", | ||||||||||
"appID": "org.w3c.miniapp", | ||||||||||
"name": "$string:name", | ||||||||||
"short_name": "string:short_name", | ||||||||||
"versionName": "1.0.0", | ||||||||||
"versionCode": 1, | ||||||||||
"description": "$string:description_application", | ||||||||||
"icons": [ | ||||||||||
{ | ||||||||||
"src": "common/icons/icon.png", | ||||||||||
"sizes": "48x48" | ||||||||||
} | ||||||||||
] | ||||||||||
} | ||||||||||
</pre> | ||||||||||
|
||||||||||
<p its-locale-filter-list="en" lang="en"> | ||||||||||
In this way, when reading the MiniApp Manifest, the MiniApp processor, such as marketplace, can extract the string resource information from the corresponding language file in the MiniApp package's i18n directory according to the configuration information of itself and generates the localized description. For example, if the configuration information of the marketplace is simplified Chinese, the marketplace parses the "name": "$string: name" statement in the manifest and extracts string: name information from the zh-Hans.json file in the MiniApp package's i18n directory. And then it generates the localized name of the MiniApp: 小程序试用版。 | ||||||||||
</p> | ||||||||||
<p its-locale-filter-list="zh-hans" lang="zh-hans"> | ||||||||||
通过上述方式,应用市场在读取应用manifest时,会根据自身的配置信息,从i18n目录下相应的语言文件,提取字符串信息,生成本地描述。例如 应用市场配置信息为汉语简体,则应用市场会解析manifest中"name": "$string:name"语句,从i18n目录的zh-Hans.json文件,提取string:name信息:小程序试用版,并在应用市场生成该应用的本地化名称:小程序试用版。 | ||||||||||
</p> | ||||||||||
|
||||||||||
</section> | ||||||||||
</section> | ||||||||||
|
||||||||||
<section> | ||||||||||
<h2> | ||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.