feat(i18n): complete Portuguese, add Brazilian Portuguese (pt_BR)
Some checks are pending
ci / analyze (push) Waiting to run
ci / test-commons-core (push) Waiting to run
ci / test-app-seeds (push) Waiting to run

Fill the ~74 UI strings pt.i18n.json was missing (saved searches, label
scanning, Plantaré, lot history), then add pt_BR as a proper Brazilian
variant rather than a copy of European Portuguese: tu/teu/tua -> você/
seu/sua with matching verb conjugation, partilhar -> compartilhar, and
Guardar -> Salvar for UI actions (seed-saving keeps "guardar", the
correct term in both variants). Wires AppLocale.ptBr into the language
picker and regenerates slang output.
This commit is contained in:
vjrj 2026-07-20 23:11:01 +02:00
parent 071be44851
commit d80f6d50fa
19 changed files with 5231 additions and 1920 deletions

View file

@ -0,0 +1,41 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:tane/i18n/strings.g.dart';
/// Brazilian Portuguese (`pt_BR`) is the first locale in the app to carry a
/// region code alongside a base language that already has its own locale
/// (`pt`, European Portuguese) a case slang and the settings picker had
/// never exercised before. These tests pin that both variants are wired
/// distinctly and neither silently falls back to the other.
void main() {
test('pt and pt_BR are both supported, as distinct locales', () {
expect(
AppLocaleUtils.supportedLocales,
containsAll([const Locale('pt'), const Locale('pt', 'BR')]),
);
});
test('core strings resolve in Brazilian Portuguese', () {
final ptBr = AppLocale.ptBr.buildSync();
expect(ptBr.menu.inventory, 'Inventário');
expect(ptBr.common.save, 'Salvar');
expect(ptBr.settings.langPtBr, 'Português (Brasil)');
});
test('pt_BR wording diverges from pt where Brazilian usage differs', () {
final pt = AppLocale.pt.buildSync();
final ptBr = AppLocale.ptBr.buildSync();
// European Portuguese uses "Guardar"; Brazilian software uses "Salvar".
expect(pt.common.save, 'Guardar');
expect(ptBr.common.save, 'Salvar');
});
test('pt_BR translates a key added after the initial pt rollout', () {
final en = AppLocale.en.buildSync();
final ptBr = AppLocale.ptBr.buildSync();
// savedSearches was a later addition; if pt_BR were missing it, this
// would silently surface the English fallback instead.
expect(ptBr.savedSearches.title, isNot(en.savedSearches.title));
expect(ptBr.savedSearches.title, isNotEmpty);
});
}