Skip to content

[gen-l10n] Should not parse empty arb files as JSON content #128932

@AlexV525

Description

@AlexV525

Is there an existing issue for this?

Steps to reproduce

  1. flutter create bug
  2. Integrate l10n as suggested.
  3. Add format: true to l10n.yaml.
  4. Create an empty arb file without any content in it (totally empty not even with {}).
  5. Run flutter gen-l10n.

Expected results

Only the generated dart files should be formatted.

Actual results

l10n files except the untranslated message file are formatted.

Code sample

Code sample
synthetic-package: false
arb-dir: lib/src
format: true
output-dir: lib/src/gen
output-localization-file: app_localizations.dart
template-arb-file: l10n_en.arb
untranslated-messages-file: lib/src/gen/localizations_untranslated.json

Screenshots or Video

No response

Logs

Logs
Because l10n.yaml exists, the options defined there will be used instead.                                                                                                                                                                                
To use the command line arguments, delete the l10n.yaml file in the Flutter project.


The arb file X:\Coding\Garages\packages\l10n\lib/src\l10n_zh.arb has the following formatting issue: 
FormatException: Unexpected end of input (at character 1)

^

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.22621.1848], locale en-US)
    • Flutter version 3.10.5 on channel stable at X:\SDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (33 hours ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)found in release: 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions