i18n icon indicating copy to clipboard operation
i18n copied to clipboard

There is no title1 in the generated code

Open yixuan2009 opened this issue 3 years ago • 1 comments

Tee intl_en.arb :

{
  "@@last_modified": "2022-05-25T22:20:15.821290",
  "@@locale":"en",
  "title1": "Flutter APP EN",
  "@title1": {
    "description": "Title for the Demo application",
    "type": "text",
    "placeholders_order": [],
    "placeholders": {}
  }
}

I run this to generator the code:

flutter pub run intl_generator:extract_to_arb --output-dir=l10n-arb \lib/cal2.dart
flutter pub run intl_generator:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/l10n/localization_intl.dart l10n-arb/intl_*.arb

This is my generator code:

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = MessageLookup();

typedef String MessageIfAbsent(String? messageStr, List<Object>? args);

class MessageLookup extends MessageLookupByLibrary {
  String get localeName => 'en';

  final messages = _notInlinedMessages(_notInlinedMessages);
  static Map<String, Function> _notInlinedMessages(_) => <String, Function>{};
}

This is your demo:

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = MessageLookup();

final _keepAnalysisHappy = Intl.defaultLocale;

typedef MessageIfAbsent(String message_str, List args);

class MessageLookup extends MessageLookupByLibrary {
  get localeName => 'en';

  final messages = _notInlinedMessages(_notInlinedMessages);
  static _notInlinedMessages(_) =>
      {"title": MessageLookupByLibrary.simpleMessage("Hello World")};
}

yixuan2009 avatar May 26 '22 03:05 yixuan2009

I cannot reproduce this - maybe you should specify \lib/cal2.dart also for the intl_generator:generate_from_arb command.

mosuem avatar Nov 04 '22 12:11 mosuem