This commit is contained in:
Thibault Deckers 2022-04-08 10:30:32 +09:00
parent 6893e8ad00
commit ff874dffdf
8 changed files with 90 additions and 19 deletions

View file

@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
## <a id="unreleased"></a>[Unreleased]
### Added
- Info: improved GeoTIFF section
- GeoTIFF: locating from GeoTIFF metadata (requires rescan, limited to some projections)
- GeoTIFF: overlay on map (limited to some projections)
- Italian translation (thanks glemco)
### Changed
- upgraded Flutter to stable v2.10.4

View file

@ -85,7 +85,7 @@ At this stage this project does *not* accept PRs, except for translations.
### Translations
If you want to translate this app in your language and share the result, [there is a guide](https://github.com/deckerst/aves/wiki/Contributing-to-Translations). English, Korean and French are already handled by me. Russian, German, Spanish, Portuguese, Indonesian & Japanese are handled by generous volunteers.
If you want to translate this app in your language and share the result, [there is a guide](https://github.com/deckerst/aves/wiki/Contributing-to-Translations). English, Korean and French are already handled by me. Russian, German, Spanish, Portuguese, Indonesian, Japanese & Italian are handled by generous volunteers.
### Donations

View file

@ -361,7 +361,7 @@
"albumPickPageTitleCopy": "Copia su album",
"albumPickPageTitleExport": "Esportazione su album",
"albumPickPageTitleMove": "Sposta su Album",
"albumPickPageTitleMove": "Sposta su album",
"albumPickPageTitlePick": "Scegli l'album",
"albumCamera": "Camera",

View file

@ -11,6 +11,7 @@ class AboutCredits extends StatelessWidget {
'Bahasa Indonesia': 'MeFinity',
'Deutsch': 'JanWaldhorn',
'Español (México)': 'n-berenice',
'Italiano': 'glemco',
'Português (Brasil)': 'Jonatas De Almeida Barros',
'Русский': 'D3ZOXY',
'日本語': 'Maki',

View file

@ -142,7 +142,6 @@ class AppDrawer extends StatelessWidget {
),
child: Wrap(
spacing: 8,
runSpacing: 8,
children: [
OutlinedButton.icon(
// key is expected by test driver

View file

@ -2,15 +2,18 @@ import 'dart:collection';
import 'package:aves/l10n/l10n.dart';
import 'package:aves/model/settings/settings.dart';
import 'package:aves/theme/durations.dart';
import 'package:aves/widgets/common/basic/reselectable_radio_list_tile.dart';
import 'package:aves/widgets/common/extensions/build_context.dart';
import 'package:aves/widgets/dialogs/aves_selection_dialog.dart';
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
import 'package:aves/widgets/settings/language/locales.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:provider/provider.dart';
class LocaleTile extends StatelessWidget {
static const _systemLocaleOption = Locale('system');
static const systemLocaleOption = Locale('system');
const LocaleTile({Key? key}) : super(key: key);
@ -23,33 +26,89 @@ class LocaleTile extends StatelessWidget {
subtitle: Selector<Settings, Locale?>(
selector: (context, s) => settings.locale,
builder: (context, locale, child) {
return Text(locale == null ? context.l10n.settingsSystemDefault : _getLocaleName(locale));
return Text(locale == null ? context.l10n.settingsSystemDefault : getLocaleName(locale));
},
),
onTap: () => showSelectionDialog<Locale>(
context: context,
builder: (context) => AvesSelectionDialog<Locale>(
initialValue: settings.locale ?? _systemLocaleOption,
options: _getLocaleOptions(context),
title: context.l10n.settingsLanguage,
dense: true,
),
onSelection: (v) => settings.locale = v == _systemLocaleOption ? null : v,
onTap: () async {
final value = await Navigator.push<Locale>(
context,
MaterialPageRoute(
settings: const RouteSettings(name: LocaleSelectionPage.routeName),
builder: (context) => const LocaleSelectionPage(),
),
);
// wait for the dialog to hide as applying the change may block the UI
await Future.delayed(Durations.pageTransitionAnimation * timeDilation);
if (value != null) {
settings.locale = value == systemLocaleOption ? null : value;
}
},
);
}
String _getLocaleName(Locale locale) {
static String getLocaleName(Locale locale) {
// the package `flutter_localized_locales` has the answer for all locales
// but it comes with 3 MB of assets
return SupportedLocales.languagesByLanguageCode[locale.languageCode] ?? locale.toString();
}
}
class LocaleSelectionPage extends StatefulWidget {
static const routeName = '/settings/locale';
const LocaleSelectionPage({Key? key}) : super(key: key);
@override
State<LocaleSelectionPage> createState() => _LocaleSelectionPageState();
}
class _LocaleSelectionPageState extends State<LocaleSelectionPage> {
late Locale _selectedValue;
@override
void initState() {
super.initState();
_selectedValue = settings.locale ?? LocaleTile.systemLocaleOption;
}
@override
Widget build(BuildContext context) {
return MediaQueryDataProvider(
child: Scaffold(
appBar: AppBar(
title: Text(context.l10n.settingsLanguage),
),
body: SafeArea(
child: ListView(
children: _getLocaleOptions(context).entries.map((kv) {
final value = kv.key;
final title = kv.value;
return ReselectableRadioListTile<Locale>(
// key is expected by test driver
key: Key(value.toString()),
value: value,
groupValue: _selectedValue,
onChanged: (v) => Navigator.pop(context, v),
reselectable: true,
title: Text(
title,
softWrap: false,
overflow: TextOverflow.fade,
maxLines: 1,
),
);
}).toList(),
),
),
),
);
}
LinkedHashMap<Locale, String> _getLocaleOptions(BuildContext context) {
final displayLocales = AppLocalizations.supportedLocales.map((locale) => MapEntry(locale, _getLocaleName(locale))).toList()..sort((a, b) => compareAsciiUpperCase(a.value, b.value));
final displayLocales = AppLocalizations.supportedLocales.map((locale) => MapEntry(locale, LocaleTile.getLocaleName(locale))).toList()..sort((a, b) => compareAsciiUpperCase(a.value, b.value));
return LinkedHashMap.of({
_systemLocaleOption: context.l10n.settingsSystemDefault,
LocaleTile.systemLocaleOption: context.l10n.settingsSystemDefault,
...LinkedHashMap.fromEntries(displayLocales),
});
}

View file

@ -7,6 +7,7 @@ class SupportedLocales {
'es': 'Español (México)',
'fr': 'Français',
'id': 'Bahasa Indonesia',
'it': 'Italiano',
'ja': '日本語',
'ko': '한국어',
'pt': 'Português (Brasil)',

View file

@ -15,6 +15,10 @@
"entryActionShowGeoTiffOnMap"
],
"it": [
"entryActionShowGeoTiffOnMap"
],
"ja": [
"entryActionShowGeoTiffOnMap"
],