Skip to content

Commit 1bb1100

Browse files
authored
📝 Add localizations in READMEs (#381)
* Update .all-contributorsrc * Update README.md * Update README.md * Update README.md * Update README-ZH.md * Apply suggestions from code review
1 parent c565475 commit 1bb1100

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

.all-contributorsrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
"login": "taqiabdulaziz",
181181
"name": "Muhammad Taqi Abdul Aziz",
182182
"avatar_url": "https://avatars.githubusercontent.com/u/30410316?v=4",
183-
"profile": "http://taqi.me",
183+
"profile": "https://github.com/taqiabdulaziz",
184184
"contributions": [
185185
"doc"
186186
]

README-ZH.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ Language: [English](README.md) | 中文
4646
* [macOS](#macos)
4747
* [使用方法](#使用方法-)
4848
* [简单的使用方法](#简单的使用方法)
49-
* [使用自定义代理](#使用自定义代理)
5049
* [更详细的使用方法](#更详细的使用方法)
50+
* [国际化](#国际化)
51+
* [使用自定义代理](#使用自定义代理)
5152
* [展示选中的资源](#展示选中的资源)
5253
* [注册资源变化回调](#注册资源变化回调)
5354
* [自定义类型或 UI](#自定义类型或-ui)
@@ -246,6 +247,25 @@ final List<AssetEntity>? result = await AssetPicker.pickAssets(
246247

247248
我们已将常用的调用方法封装在 [example](example) 中。
248249

250+
### 国际化
251+
252+
当你在选择资源的时候,package 会通过你的 `BuildContext`
253+
读取 `Locale?`,返回对应语言的文字代理实现。
254+
请确保你可以通过 `BuildContext` 获取到 `Locale`,否则将会 **默认展示中文文字**
255+
256+
内置的语言文字实现有:
257+
* 简体中文 (默认)
258+
* English
259+
* העברית
260+
* Deutsche
261+
* Локализация
262+
* 日本語
263+
* مة العربية
264+
* Délégué
265+
266+
如果你想使用自定义或固定的文字实现,请通过
267+
`AssetPickerConfig.textDelegate` 传递调用。
268+
249269
### 使用自定义代理
250270

251271
你只能在使用 `pickAssetsWithDelegate` 方法时

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ UI designs will be updated following the WeChat update in anytime.
4747
* [Usage](#usage-)
4848
* [Simple usage](#simple-usage)
4949
* [Detailed usage](#detailed-usage)
50+
* [Localizations](#localizations)
5051
* [Using custom delegate](#using-custom-delegate)
5152
* [Display selected assets](#display-selected-assets)
5253
* [Register assets change observe callback](#register-assets-change-observe-callback)
@@ -249,6 +250,27 @@ Fields in `AssetPickerConfig`:
249250
TL;DR, we've put multiple common usage
250251
with the packages in the [example](example).
251252

253+
### Localizations
254+
255+
When you're picking assets, the package will obtain the `Locale?`
256+
from your `BuildContext`, and return the corresponding text delegate
257+
of the current language.
258+
Make sure you have a valid `Locale` in your widget tree that can be accessed
259+
from the `BuildContext`. Otherwise, **the default Chinese delegate will be used.**
260+
261+
Embedded text delegates languages are:
262+
* 简体中文 (default)
263+
* English
264+
* העברית
265+
* Deutsche
266+
* Локализация
267+
* 日本語
268+
* مة العربية
269+
* Délégué
270+
271+
If you want to use a custom/fixed text delegate, pass it through the
272+
`AssetPickerConfig.textDelegate`.
273+
252274
### Using custom delegate
253275

254276
You can use the `keepScrollOffset` feature
@@ -421,7 +443,7 @@ Many thanks to these wonderful people ([emoji key](https://allcontributors.org/d
421443
<td align="center"><a href="https://github.com/maxzod"><img src="https://avatars.githubusercontent.com/u/47630729?v=4?s=50" width="50px;" alt="Ahmed Masoud "/><br /><sub><b>Ahmed Masoud </b></sub></a><br /><a href="#translation-maxzod" title="Translation">🌍</a></td>
422444
<td align="center"><a href="https://github.com/luomo-pro"><img src="https://avatars.githubusercontent.com/u/41097395?v=4?s=50" width="50px;" alt="luomo-pro"/><br /><sub><b>luomo-pro</b></sub></a><br /><a href="#a11y-luomo-pro" title="Accessibility">️️️️♿️</a> <a href="https://github.com/fluttercandies/flutter_wechat_assets_picker/issues?q=author%3Aluomo-pro" title="Bug reports">🐛</a></td>
423445
<td align="center"><a href="https://github.com/paigupai"><img src="https://avatars.githubusercontent.com/u/44311361?v=4?s=50" width="50px;" alt="paigupai"/><br /><sub><b>paigupai</b></sub></a><br /><a href="#translation-paigupai" title="Translation">🌍</a></td>
424-
<td align="center"><a href="http://taqi.me"><img src="https://avatars.githubusercontent.com/u/30410316?v=4?s=50" width="50px;" alt="Muhammad Taqi Abdul Aziz"/><br /><sub><b>Muhammad Taqi Abdul Aziz</b></sub></a><br /><a href="https://github.com/fluttercandies/flutter_wechat_assets_picker/commits?author=taqiabdulaziz" title="Documentation">📖</a></td>
446+
<td align="center"><a href="https://github.com/taqiabdulaziz"><img src="https://avatars.githubusercontent.com/u/30410316?v=4?s=50" width="50px;" alt="Muhammad Taqi Abdul Aziz"/><br /><sub><b>Muhammad Taqi Abdul Aziz</b></sub></a><br /><a href="https://github.com/fluttercandies/flutter_wechat_assets_picker/commits?author=taqiabdulaziz" title="Documentation">📖</a></td>
425447
<td align="center"><a href="http://blog.1qa.link"><img src="https://avatars.githubusercontent.com/u/8766034?v=4?s=50" width="50px;" alt="何锦余"/><br /><sub><b>何锦余</b></sub></a><br /><a href="https://github.com/fluttercandies/flutter_wechat_assets_picker/issues?q=author%3Ahellohejinyu" title="Bug reports">🐛</a></td>
426448
</tr>
427449
</tbody>

0 commit comments

Comments
 (0)