docs(readme): 更新国际化使用示例和文档说明
- 添加资源定义示例表格说明 - 补充 ViewModel 属性绑定示例代码 - 修正 Hello 文本绑定示例为 UserName - 增加绑定语法使用示例 - 完善国际化标签使用说明
This commit is contained in:
17
Readme.MD
17
Readme.MD
@@ -50,10 +50,21 @@ var value = I18NManager.Get<string>("Hello", CultureInfo.InvariantCulture, Usern
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:i18N="clr-namespace:JackCraft.I18N;assembly=JackCraft.I18N">
|
||||
<StackPanel>
|
||||
<!-- Resources:
|
||||
资源名称 | 默认值 | 中文
|
||||
Test | Test | 测试
|
||||
Hello | Hello, {0} | 你好, {0}
|
||||
-->
|
||||
<!-- ViewModel:
|
||||
public string UserText { get; set; } = "UserName";
|
||||
public string TestKey { get; set; } = "Test";
|
||||
public string HelloKey { get; set; } = "Hello";
|
||||
-->
|
||||
<TextBlock Text="{i18N:I18N Test}" /> <!-- 输出: 测试 -->
|
||||
<TextBlock Text="{i18N:I18N Hello, User}" /> <!-- 输出: 你好, User -->
|
||||
<!-- ViewModel: public string User { get; set; } = "User"; -->
|
||||
<TextBlock Text="{i18N:I18N Hello, {Binding User}}" /> <!-- 输出: 你好, User -->
|
||||
<TextBlock Text="{i18N:I18N Hello, UserName}" /> <!-- 输出: 你好, UserName -->
|
||||
<TextBlock Text="{i18N:I18N Hello, {Binding UserText}}" /> <!-- 输出: 你好, UserName -->
|
||||
<TextBlock Text="{i18N:I18N {Binding Test}}" /> <!-- 输出: 测试 -->
|
||||
<TextBlock Text="{i18N:I18N {Binding HelloKey}, {Binding HelloKey}}" /> <!-- 输出: 你好, Hello -->
|
||||
</StackPanel>
|
||||
</Window>
|
||||
```
|
||||
Reference in New Issue
Block a user