Add annotation
diff --git a/pkgs/messages/example_json/bin/example.dart b/pkgs/messages/example_json/bin/example.dart index 1b6b131..6143153 100644 --- a/pkgs/messages/example_json/bin/example.dart +++ b/pkgs/messages/example_json/bin/example.dart
@@ -23,6 +23,7 @@ await messages.loadLocale('fr'); print('AboutMessage fr:'); print('\t${messages.aboutMessage('typesafe.fr')}'); + print('\t${messages.helloAndWelcome('henry', 5)}'); ///To enable this, add `generateFindById: true` to the pubspec section // print('\t${messages.getById('aboutMessage', ['get-by-id.fr'])}');
diff --git a/pkgs/messages/lib/src/message_format.dart b/pkgs/messages/lib/src/message_format.dart index 909d7a4..a92949e 100644 --- a/pkgs/messages/lib/src/message_format.dart +++ b/pkgs/messages/lib/src/message_format.dart
@@ -2,6 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:meta/meta.dart'; + // ignore_for_file: non_constant_identifier_names import 'plural_selector.dart'; @@ -32,9 +34,19 @@ Preamble get preamble; PluralSelector get pluralSelector; - String generateStringAtIndex(int index, List args); + String _generateStringAtIndex(int index, List args); - String generateStringAtId(String id, List args); + String _generateStringAtId(String id, List args); +} + +extension MessageListStatic on MessageList { + @ResourceIdentifier() + String generateStringAtIndex(int index, List args) => + _generateStringAtIndex(index, args); + + @ResourceIdentifier() + String generateStringAtId(String id, List args) => + _generateStringAtId(id, args); } sealed class PluralMarker {
diff --git a/pkgs/messages/pubspec.yaml b/pkgs/messages/pubspec.yaml index 75eb2b4..dc0aaba 100644 --- a/pkgs/messages/pubspec.yaml +++ b/pkgs/messages/pubspec.yaml
@@ -10,6 +10,7 @@ collection: ^1.17.1 intl: ^0.18.0 logging: ^1.2.0 + meta: ^1.15.0 native_assets_cli: ^0.6.0 path: ^1.9.0