Skip to content

Commit 75ad491

Browse files
authored
Add system channel to access the localization plugin. (flutter#76847)
1 parent dc1cb29 commit 75ad491

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/flutter/lib/src/services/system_channels.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,20 @@ class SystemChannels {
344344
'flutter/deferredcomponent',
345345
StandardMethodCodec(),
346346
);
347+
348+
/// A JSON [MethodChannel] for localization.
349+
///
350+
/// The following outgoing methods are defined for this channel (invoked using
351+
/// [OptionalMethodChannel.invokeMethod]):
352+
///
353+
/// * `Localization.getStringResource`: Obtains the native string resource
354+
/// for a specific locale. The argument is a [Map] with two keys, `key`
355+
/// giving a [String] which the resource is defined with, and an optional
356+
/// `locale` which is a [String] containing the BCP47 locale identifier of
357+
/// the locale requested. See [Locale.toLanguageTag]. When `locale` is not
358+
/// specified, the current system locale is used instead.
359+
static const MethodChannel localization = OptionalMethodChannel(
360+
'flutter/localization',
361+
JSONMethodCodec(),
362+
);
347363
}

0 commit comments

Comments
 (0)