|
final MethodChannel | channel |
|
final MethodChannel.MethodCallHandler | handler |
|
Sends the platform's locales to Dart.
Definition at line 22 of file LocalizationChannel.java.
◆ LocalizationChannel()
io.flutter.embedding.engine.systemchannels.LocalizationChannel.LocalizationChannel |
( |
@NonNull DartExecutor |
dartExecutor | ) |
|
|
inline |
Definition at line 61 of file LocalizationChannel.java.
61 {
62 this.channel =
63 new MethodChannel(dartExecutor, "flutter/localization", JSONMethodCodec.INSTANCE);
65 }
final MethodChannel channel
final MethodChannel.MethodCallHandler handler
◆ sendLocales()
void io.flutter.embedding.engine.systemchannels.LocalizationChannel.sendLocales |
( |
@NonNull List< Locale > |
locales | ) |
|
|
inline |
Send the given locales
to Dart.
Definition at line 77 of file LocalizationChannel.java.
77 {
78 Log.v(TAG,
"Sending Locales to Flutter.");
79
81 for (Locale locale : locales) {
83 TAG,
84 "Locale (Language: "
85 + locale.getLanguage()
86 + ", Country: "
87 + locale.getCountry()
88 + ", Variant: "
89 + locale.getVariant()
90 + ")");
91 data.add(locale.getLanguage());
92 data.add(locale.getCountry());
93 data.add(locale.getScript());
94 data.add(locale.getVariant());
95 }
96 channel.invokeMethod(
"setLocale", data);
97 }
void Log(const char *format,...) SK_PRINTF_LIKE(1
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
◆ setLocalizationMessageHandler()
void io.flutter.embedding.engine.systemchannels.LocalizationChannel.setLocalizationMessageHandler |
( |
@Nullable LocalizationMessageHandler |
localizationMessageHandler | ) |
|
|
inline |
◆ channel
final MethodChannel io.flutter.embedding.engine.systemchannels.LocalizationChannel.channel |
◆ handler
final MethodChannel.MethodCallHandler io.flutter.embedding.engine.systemchannels.LocalizationChannel.handler |
Definition at line 29 of file LocalizationChannel.java.
30 {
31 @Override
32 public void onMethodCall(@NonNull
MethodCall call, @NonNull MethodChannel.Result
result) {
33 if (localizationMessageHandler == null) {
34
35
36 return;
37 }
38
39 String method =
call.method;
40 switch (method) {
41 case "Localization.getStringResource":
42 JSONObject arguments =
call.<JSONObject>arguments();
43 try {
44 String
key = arguments.getString(
"key");
45 String localeString = null;
46 if (arguments.has("locale")) {
47 localeString = arguments.getString("locale");
48 }
50 } catch (JSONException exception) {
51 result.error(
"error", exception.getMessage(),
null);
52 }
53 break;
54 default:
56 break;
57 }
58 }
59 };
String getStringResource(@NonNull String key, @NonNull String locale)
The documentation for this class was generated from the following file: