Skip to content

Commit

Permalink
Use leap localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 27, 2024
1 parent f5bc161 commit 3325a1a
Show file tree
Hide file tree
Showing 59 changed files with 147 additions and 132 deletions.
4 changes: 2 additions & 2 deletions app/lib/api/changes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ Future<NoteData?> checkFileChanges(BuildContext context, NoteData data) async {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text(AppLocalizations.of(context).cancel)),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel)),
TextButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text(AppLocalizations.of(context).ok)),
child: Text(MaterialLocalizations.of(context).okButtonLabel)),
],
),
);
Expand Down
4 changes: 2 additions & 2 deletions app/lib/api/close_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class IOCloseSubscription extends CloseSubscription with WindowListener {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text(AppLocalizations.of(context).close),
child: Text(MaterialLocalizations.of(context).closeButtonLabel),
),
],
),
Expand Down
5 changes: 3 additions & 2 deletions app/lib/dialogs/background/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ class BackgroundDialog extends StatelessWidget {
),
actions: [
TextButton(
child: Text(AppLocalizations.of(context).cancel),
child:
Text(MaterialLocalizations.of(context).cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
ElevatedButton(
child: Text(AppLocalizations.of(context).ok),
child: Text(MaterialLocalizations.of(context).okButtonLabel),
onPressed: () {
context.read<DocumentBloc>().add(DocumentBackgroundsChanged(
[if (background != null) background!]));
Expand Down
6 changes: 3 additions & 3 deletions app/lib/dialogs/collaboration/start.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _StartCollaborationDialogState extends State<StartCollaborationDialog>
controller: _addressController,
validator: (value) {
if (value?.isEmpty ?? true) {
return AppLocalizations.of(context).shouldNotEmpty;
return LeapLocalizations.of(context).shouldNotEmpty;
}
final address = InternetAddress.tryParse(value!);
if (address == null) {
Expand All @@ -72,7 +72,7 @@ class _StartCollaborationDialogState extends State<StartCollaborationDialog>
keyboardType: TextInputType.number,
validator: (value) {
if (value?.isEmpty ?? true) {
return AppLocalizations.of(context).shouldNotEmpty;
return LeapLocalizations.of(context).shouldNotEmpty;
}
final number = int.tryParse(value!);
if (number == null) {
Expand All @@ -95,7 +95,7 @@ class _StartCollaborationDialogState extends State<StartCollaborationDialog>
),
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(AppLocalizations.of(context).close),
child: Text(MaterialLocalizations.of(context).closeButtonLabel),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dialogs/collaboration/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ViewCollaborationDialog extends StatelessWidget {
},
),
TextButton(
child: Text(AppLocalizations.of(context).close),
child: Text(MaterialLocalizations.of(context).closeButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
],
Expand Down
3 changes: 2 additions & 1 deletion app/lib/dialogs/export/general.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ class _GeneralExportDialogState extends State<GeneralExportDialog> {
children: [
Expanded(child: Container()),
TextButton(
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context)
.cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
if (supportsShare())
Expand Down
9 changes: 5 additions & 4 deletions app/lib/dialogs/export/pdf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ class _PdfExportDialogState extends State<PdfExportDialog> {
Expanded(child: Container()),
TextButton(
child: Text(
AppLocalizations.of(context).cancel),
MaterialLocalizations.of(context)
.cancelButtonLabel),
onPressed: () =>
Navigator.of(context).pop(),
),
Expand Down Expand Up @@ -497,7 +498,7 @@ class _AreaSelectionDialogState extends State<_AreaSelectionDialog> {
Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton(
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
),
Expand Down Expand Up @@ -543,7 +544,7 @@ class _ExportPresetsDialogState extends State<ExportPresetsDialog> {
bloc.add(ExportPresetCreated(name, widget.areas!));
},
icon: const PhosphorIcon(PhosphorIconsLight.plus),
tooltip: AppLocalizations.of(context).create,
tooltip: LeapLocalizations.of(context).create,
)
]),
Padding(
Expand Down Expand Up @@ -600,7 +601,7 @@ class _ExportPresetsDialogState extends State<ExportPresetsDialog> {
Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton(
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
),
Expand Down
12 changes: 6 additions & 6 deletions app/lib/dialogs/file_system/create.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:butterfly/api/file_system.dart';
import 'package:butterfly/models/defaults.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:material_leap/l10n/leap_localizations.dart';

class FileSystemAssetCreateDialog extends StatefulWidget {
final bool isFolder;
Expand Down Expand Up @@ -37,13 +37,13 @@ class _FileSystemAssetCreateDialogState
key: _formKey,
child: AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
title: Text(AppLocalizations.of(context).create),
title: Text(LeapLocalizations.of(context).create),
content: TextFormField(
decoration: InputDecoration(
filled: true, labelText: AppLocalizations.of(context).name),
filled: true, labelText: LeapLocalizations.of(context).name),
validator: (value) {
if (value?.isEmpty ?? true) {
return AppLocalizations.of(context).shouldNotEmpty;
return LeapLocalizations.of(context).shouldNotEmpty;
}
return null;
},
Expand All @@ -52,11 +52,11 @@ class _FileSystemAssetCreateDialogState
),
actions: [
TextButton(
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
ElevatedButton(
child: Text(AppLocalizations.of(context).create),
child: Text(LeapLocalizations.of(context).create),
onPressed: () async {
final navigator = Navigator.of(context);
if (_formKey.currentState?.validate() ?? false) {
Expand Down
7 changes: 4 additions & 3 deletions app/lib/dialogs/file_system/move.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:butterfly/api/file_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:lw_file_system/lw_file_system.dart';
import 'package:material_leap/l10n/leap_localizations.dart';

import 'tree.dart';

Expand Down Expand Up @@ -73,12 +74,12 @@ class _FileSystemAssetMoveDialogState extends State<FileSystemAssetMoveDialog> {
return AlertDialog(
actions: [
TextButton(
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(null),
),
if (widget.moveMode != null)
ElevatedButton(
child: Text(AppLocalizations.of(context).ok),
child: Text(MaterialLocalizations.of(context).okButtonLabel),
onPressed: () => _move(widget.moveMode == MoveMode.duplicate),
),
if (widget.moveMode == null) ...[
Expand All @@ -105,7 +106,7 @@ class _FileSystemAssetMoveDialogState extends State<FileSystemAssetMoveDialog> {
const SizedBox(height: 16),
TextField(
decoration: InputDecoration(
filled: true, hintText: AppLocalizations.of(context).name),
filled: true, hintText: LeapLocalizations.of(context).name),
autofocus: true,
controller: _nameController,
),
Expand Down
8 changes: 5 additions & 3 deletions app/lib/dialogs/file_system/tree.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:butterfly/api/file_system.dart';
import 'package:flutter/material.dart';
import 'package:lw_file_system/lw_file_system.dart';
import 'package:material_leap/l10n/leap_localizations.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

Expand Down Expand Up @@ -139,7 +140,7 @@ class FileSystemDirectoryTreeViewState
autofocus: true,
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: AppLocalizations.of(context).name,
labelText: LeapLocalizations.of(context).name,
),
onChanged: (value) => name = value,
onFieldSubmitted: (value) {
Expand All @@ -149,10 +150,11 @@ class FileSystemDirectoryTreeViewState
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text(AppLocalizations.of(context).cancel)),
child: Text(
MaterialLocalizations.of(context).cancelButtonLabel)),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true),
child: Text(AppLocalizations.of(context).create))
child: Text(LeapLocalizations.of(context).create))
],
);
}) ??
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dialogs/import/add.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class _AddDialogState extends State<AddDialog> {
IconButton.outlined(
onPressed: () => Navigator.of(context).pop(),
icon: const PhosphorIcon(PhosphorIconsLight.x),
tooltip: AppLocalizations.of(context).close,
tooltip: MaterialLocalizations.of(context).closeButtonLabel,
),
const SizedBox(width: 16),
Text(
Expand Down
7 changes: 4 additions & 3 deletions app/lib/dialogs/import/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,13 @@ class _CameraDialogState extends State<CameraDialog>
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
child:
Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context)
.cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
ElevatedButton(
child: Text(AppLocalizations.of(context).ok),
child: Text(MaterialLocalizations.of(context)
.okButtonLabel),
// Capture image on button press.
onPressed: () async {
final navigator = Navigator.of(context);
Expand Down
6 changes: 3 additions & 3 deletions app/lib/dialogs/import/confirmation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PackImportConfirmationDialog extends StatelessWidget {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true),
Expand Down Expand Up @@ -54,7 +54,7 @@ class TemplateImportConfirmationDialog extends StatelessWidget {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text(AppLocalizations.of(context).cancel),
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true),
Expand All @@ -78,7 +78,7 @@ class UnknownImportConfirmationDialog extends StatelessWidget {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(AppLocalizations.of(context).close),
child: Text(MaterialLocalizations.of(context).closeButtonLabel),
),
],
);
Expand Down
6 changes: 4 additions & 2 deletions app/lib/dialogs/import/note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ class _NoteImportDialogState extends State<NoteImportDialog> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
child: Text(AppLocalizations.of(context).cancel),
child: Text(
MaterialLocalizations.of(context).cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
ElevatedButton(
child: Text(AppLocalizations.of(context).ok),
child:
Text(MaterialLocalizations.of(context).okButtonLabel),
onPressed: () => Navigator.of(context).pop(
NoteDialogCallback(_selectedPages, _selectedPacks)),
),
Expand Down
5 changes: 3 additions & 2 deletions app/lib/dialogs/import/pages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ class _PagesDialogState extends State<PagesDialog> {
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
child: Text(AppLocalizations.of(context).cancel),
child:
Text(MaterialLocalizations.of(context).cancelButtonLabel),
onPressed: () => Navigator.of(context).pop(),
),
ElevatedButton(
child: Text(AppLocalizations.of(context).ok),
child: Text(MaterialLocalizations.of(context).okButtonLabel),
onPressed: () => Navigator.of(context).pop(PageDialogCallback(
_selected,
_quality,
Expand Down
8 changes: 5 additions & 3 deletions app/lib/dialogs/packs/asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:butterfly_api/butterfly_api.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:material_leap/l10n/leap_localizations.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

import '../../bloc/document_bloc.dart';
Expand Down Expand Up @@ -79,7 +80,7 @@ class AssetDialog extends StatelessWidget {
const SizedBox(height: 8),
TextFormField(
decoration: InputDecoration(
labelText: AppLocalizations.of(context).name,
labelText: LeapLocalizations.of(context).name,
filled: true,
),
initialValue: name,
Expand All @@ -94,7 +95,8 @@ class AssetDialog extends StatelessWidget {
onPressed: () {
Navigator.of(context).pop();
},
child: Text(AppLocalizations.of(context).cancel),
child:
Text(MaterialLocalizations.of(context).cancelButtonLabel),
),
ElevatedButton(
onPressed: () {
Expand All @@ -104,7 +106,7 @@ class AssetDialog extends StatelessWidget {
name,
));
},
child: Text(AppLocalizations.of(context).ok),
child: Text(MaterialLocalizations.of(context).okButtonLabel),
),
],
);
Expand Down
2 changes: 1 addition & 1 deletion app/lib/dialogs/packs/color_pick.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class _ColorPalettePickerDialogState extends State<ColorPalettePickerDialog> {
initialValue: _palette?.name,
decoration: InputDecoration(
labelText:
AppLocalizations.of(context)
LeapLocalizations.of(context)
.name,
filled: true,
),
Expand Down
7 changes: 4 additions & 3 deletions app/lib/dialogs/packs/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ class _PacksDialogState extends State<PacksDialog>
onPressed: () =>
Navigator.of(context).pop(),
child: Text(
AppLocalizations.of(context)
.cancel),
MaterialLocalizations.of(
context)
.cancelButtonLabel),
),
ElevatedButton(
onPressed: () =>
Expand All @@ -391,7 +392,7 @@ class _PacksDialogState extends State<PacksDialog>
},
),
ListTile(
title: Text(AppLocalizations.of(ctx).create),
title: Text(LeapLocalizations.of(ctx).create),
leading: const PhosphorIcon(
PhosphorIconsLight.plusCircle),
onTap: () async {
Expand Down
3 changes: 2 additions & 1 deletion app/lib/dialogs/packs/general.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:butterfly_api/butterfly_api.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:material_leap/l10n/leap_localizations.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

class GeneralPackView extends StatelessWidget {
Expand Down Expand Up @@ -28,7 +29,7 @@ class GeneralPackView extends StatelessWidget {
const SizedBox(height: 8),
TextFormField(
decoration: InputDecoration(
labelText: AppLocalizations.of(context).name,
labelText: LeapLocalizations.of(context).name,
icon: const PhosphorIcon(PhosphorIconsLight.textT),
filled: true,
),
Expand Down
Loading

0 comments on commit 3325a1a

Please sign in to comment.