|
1 | | -using System.Collections.Frozen; |
2 | | -using System.ComponentModel; |
3 | | -using dotnetCampus.Localizations; |
| 1 | +using dotnetCampus.Localizations; |
4 | 2 |
|
5 | 3 | namespace LocalizationSample; |
6 | 4 |
|
7 | 5 | internal class Program |
8 | 6 | { |
9 | 7 | public static void Main(string[] args) |
10 | 8 | { |
| 9 | + var a = Lang.Current.A.A2.ToString(1); |
| 10 | + Console.WriteLine(a); |
11 | 11 | } |
12 | 12 | } |
13 | 13 |
|
14 | 14 | [LocalizedConfiguration(Default = "zh-hans", Current = "en")] |
15 | 15 | internal partial class Lang; |
16 | | - |
17 | | -// [EditorBrowsable(EditorBrowsableState.Never)] |
18 | | -// public interface ILocalizedValues : ILocalizedStringProvider |
19 | | -// { |
20 | | -// ILocalizedValues_A A => (ILocalizedValues_A)this; |
21 | | -// } |
22 | | -// |
23 | | -// [EditorBrowsable(EditorBrowsableState.Never)] |
24 | | -// public interface ILocalizedValues_A : ILocalizedStringProvider |
25 | | -// { |
26 | | -// LocalizedString A1 => this.Get0("A.A1"); |
27 | | -// |
28 | | -// LocalizedString<int> A2 => this.Get1<int>("A.A2"); |
29 | | -// |
30 | | -// LocalizedString<object> A3 => this.Get1<object>("A.A3"); |
31 | | -// } |
32 | | -// |
33 | | -// public class Lang_ZhHans(ILocalizedValues? fallback) : ILocalizedValues, |
34 | | -// ILocalizedValues_A |
35 | | -// { |
36 | | -// private readonly FrozenDictionary<string, string> _strings = new Dictionary<string, string> |
37 | | -// { |
38 | | -// { "A.A1", "文字" }, |
39 | | -// { "A.A2", "错误码:{0}" }, |
40 | | -// { "A.A3", "错误:{0}" }, |
41 | | -// }.ToFrozenDictionary(); |
42 | | -// |
43 | | -// public string this[string key] => _strings[key] ?? fallback![key]; |
44 | | -// |
45 | | -// public string IetfLanguageTag => "zh-hans"; |
46 | | -// } |
47 | | -// |
48 | | -// public class Lang_En(ILocalizedValues? fallback) : ILocalizedValues, |
49 | | -// ILocalizedValues_A |
50 | | -// { |
51 | | -// private readonly FrozenDictionary<string, string> _strings = new Dictionary<string, string> |
52 | | -// { |
53 | | -// { "A.A1", "Words" }, |
54 | | -// { "A.A2", "Error code: {0}" }, |
55 | | -// { "A.A3", "Error: {0}" }, |
56 | | -// }.ToFrozenDictionary(); |
57 | | -// |
58 | | -// public string this[string key] => _strings[key] ?? fallback![key]; |
59 | | -// |
60 | | -// public string IetfLanguageTag => "en"; |
61 | | -// } |
0 commit comments