HelpButton, beside a section's or a setting's title: the explanation opens in a small dialog, under its title where given, rather than standing in the everyday view (the developer's review of 3 Nov 2026). FieldInfoButton's tooltip stays for a field's short hint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
263 lines
8 KiB
Dart
263 lines
8 KiB
Dart
import 'dart:async';
|
||
|
||
import 'package:flutter/foundation.dart';
|
||
import 'package:flutter/widgets.dart';
|
||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||
import 'package:intl/intl.dart' as intl;
|
||
|
||
import 'halkyon_ui_localizations_de.dart';
|
||
import 'halkyon_ui_localizations_en.dart';
|
||
|
||
// ignore_for_file: type=lint
|
||
|
||
/// Callers can lookup localized strings with an instance of HalkyonUiLocalizations
|
||
/// returned by `HalkyonUiLocalizations.of(context)`.
|
||
///
|
||
/// Applications need to include `HalkyonUiLocalizations.delegate()` in their app's
|
||
/// `localizationDelegates` list, and the locales they support in the app's
|
||
/// `supportedLocales` list. For example:
|
||
///
|
||
/// ```dart
|
||
/// import 'l10n/halkyon_ui_localizations.dart';
|
||
///
|
||
/// return MaterialApp(
|
||
/// localizationsDelegates: HalkyonUiLocalizations.localizationsDelegates,
|
||
/// supportedLocales: HalkyonUiLocalizations.supportedLocales,
|
||
/// home: MyApplicationHome(),
|
||
/// );
|
||
/// ```
|
||
///
|
||
/// ## Update pubspec.yaml
|
||
///
|
||
/// Please make sure to update your pubspec.yaml to include the following
|
||
/// packages:
|
||
///
|
||
/// ```yaml
|
||
/// dependencies:
|
||
/// # Internationalization support.
|
||
/// flutter_localizations:
|
||
/// sdk: flutter
|
||
/// intl: any # Use the pinned version from flutter_localizations
|
||
///
|
||
/// # Rest of dependencies
|
||
/// ```
|
||
///
|
||
/// ## iOS Applications
|
||
///
|
||
/// iOS applications define key application metadata, including supported
|
||
/// locales, in an Info.plist file that is built into the application bundle.
|
||
/// To configure the locales supported by your app, you’ll need to edit this
|
||
/// file.
|
||
///
|
||
/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
|
||
/// Then, in the Project Navigator, open the Info.plist file under the Runner
|
||
/// project’s Runner folder.
|
||
///
|
||
/// Next, select the Information Property List item, select Add Item from the
|
||
/// Editor menu, then select Localizations from the pop-up menu.
|
||
///
|
||
/// Select and expand the newly-created Localizations item then, for each
|
||
/// locale your application supports, add a new item and select the locale
|
||
/// you wish to add from the pop-up menu in the Value field. This list should
|
||
/// be consistent with the languages listed in the HalkyonUiLocalizations.supportedLocales
|
||
/// property.
|
||
abstract class HalkyonUiLocalizations {
|
||
HalkyonUiLocalizations(String locale)
|
||
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
|
||
|
||
final String localeName;
|
||
|
||
static HalkyonUiLocalizations of(BuildContext context) {
|
||
return Localizations.of<HalkyonUiLocalizations>(
|
||
context,
|
||
HalkyonUiLocalizations,
|
||
)!;
|
||
}
|
||
|
||
static const LocalizationsDelegate<HalkyonUiLocalizations> delegate =
|
||
_HalkyonUiLocalizationsDelegate();
|
||
|
||
/// A list of this localizations delegate along with the default localizations
|
||
/// delegates.
|
||
///
|
||
/// Returns a list of localizations delegates containing this delegate along with
|
||
/// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
|
||
/// and GlobalWidgetsLocalizations.delegate.
|
||
///
|
||
/// Additional delegates can be added by appending to this list in
|
||
/// MaterialApp. This list does not have to be used at all if a custom list
|
||
/// of delegates is preferred or required.
|
||
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
|
||
<LocalizationsDelegate<dynamic>>[
|
||
delegate,
|
||
GlobalMaterialLocalizations.delegate,
|
||
GlobalCupertinoLocalizations.delegate,
|
||
GlobalWidgetsLocalizations.delegate,
|
||
];
|
||
|
||
/// A list of this localizations delegate's supported locales.
|
||
static const List<Locale> supportedLocales = <Locale>[
|
||
Locale('de'),
|
||
Locale('en'),
|
||
Locale('en', 'GB'),
|
||
Locale('en', 'US'),
|
||
];
|
||
|
||
/// The brand's word, above an app's own in its wordmark ("Halkyon" over "Learn").
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Halkyon'**
|
||
String get brand;
|
||
|
||
/// No description provided for @close.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Close'**
|
||
String get close;
|
||
|
||
/// No description provided for @cancel.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Cancel'**
|
||
String get cancel;
|
||
|
||
/// No description provided for @undo.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Undo'**
|
||
String get undo;
|
||
|
||
/// No description provided for @dragToReorder.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Drag to reorder'**
|
||
String get dragToReorder;
|
||
|
||
/// No description provided for @reorder.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Reorder'**
|
||
String get reorder;
|
||
|
||
/// No description provided for @reorderDone.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Done'**
|
||
String get reorderDone;
|
||
|
||
/// Below a required field while it is empty.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Required'**
|
||
String get requiredField;
|
||
|
||
/// No description provided for @decrease.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Decrease'**
|
||
String get decrease;
|
||
|
||
/// No description provided for @increase.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Increase'**
|
||
String get increase;
|
||
|
||
/// No description provided for @typeANumber.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Type a number'**
|
||
String get typeANumber;
|
||
|
||
/// No description provided for @gone.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'This no longer exists. It may have been deleted on another device.'**
|
||
String get gone;
|
||
|
||
/// No description provided for @moreInfo.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'More info'**
|
||
String get moreInfo;
|
||
|
||
/// No description provided for @copiedToClipboard.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Copied to clipboard'**
|
||
String get copiedToClipboard;
|
||
|
||
/// No description provided for @copy.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Copy'**
|
||
String get copy;
|
||
|
||
/// A colour of the palette content can take, by its stored name.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'{name, select, carrot{Carrot} cerise{Cerise} cobalt{Cobalt} copper{Copper} enzian{Enzian} fern{Fern} forest{Forest} ocean{Ocean} olive{Olive} pacific{Pacific} pickle{Pickle} pine{Pine} pink{Pink} plum{Plum} purple{Purple} reef{Reef} sahara{Sahara} slateblue{Slate blue} soil{Soil} strawberry{Strawberry} other{{name}}}'**
|
||
String paletteColorName(String name);
|
||
|
||
/// No description provided for @colorPickerLabel.
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'Colour: {color}'**
|
||
String colorPickerLabel(String color);
|
||
|
||
/// Tooltip of the question mark that opens a text explaining a section or setting (HelpButton).
|
||
///
|
||
/// In en, this message translates to:
|
||
/// **'What\'s this?'**
|
||
String get explain;
|
||
}
|
||
|
||
class _HalkyonUiLocalizationsDelegate
|
||
extends LocalizationsDelegate<HalkyonUiLocalizations> {
|
||
const _HalkyonUiLocalizationsDelegate();
|
||
|
||
@override
|
||
Future<HalkyonUiLocalizations> load(Locale locale) {
|
||
return SynchronousFuture<HalkyonUiLocalizations>(
|
||
lookupHalkyonUiLocalizations(locale),
|
||
);
|
||
}
|
||
|
||
@override
|
||
bool isSupported(Locale locale) =>
|
||
<String>['de', 'en'].contains(locale.languageCode);
|
||
|
||
@override
|
||
bool shouldReload(_HalkyonUiLocalizationsDelegate old) => false;
|
||
}
|
||
|
||
HalkyonUiLocalizations lookupHalkyonUiLocalizations(Locale locale) {
|
||
// Lookup logic when language+country codes are specified.
|
||
switch (locale.languageCode) {
|
||
case 'en':
|
||
{
|
||
switch (locale.countryCode) {
|
||
case 'GB':
|
||
return HalkyonUiLocalizationsEnGb();
|
||
case 'US':
|
||
return HalkyonUiLocalizationsEnUs();
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
// Lookup logic when only language code is specified.
|
||
switch (locale.languageCode) {
|
||
case 'de':
|
||
return HalkyonUiLocalizationsDe();
|
||
case 'en':
|
||
return HalkyonUiLocalizationsEn();
|
||
}
|
||
|
||
throw FlutterError(
|
||
'HalkyonUiLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
|
||
'an issue with the localizations generation tool. Please file an issue '
|
||
'on GitHub with a reproducible sample app and the gen-l10n configuration '
|
||
'that was used.',
|
||
);
|
||
}
|