AppLocalizations class abstract

Callers can lookup localized strings with an instance of AppLocalizations returned by AppLocalizations.of(context).

Applications need to include AppLocalizations.delegate() in their app's localizationDelegates list, and the locales they support in the app's supportedLocales list. For example:

import 'l10n/app_localizations.dart';

return MaterialApp(
  localizationsDelegates: AppLocalizations.localizationsDelegates,
  supportedLocales: AppLocalizations.supportedLocales,
  home: MyApplicationHome(),
);

Update pubspec.yaml

Please make sure to update your pubspec.yaml to include the following packages:

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 AppLocalizations.supportedLocales property.

Implementers

Constructors

AppLocalizations(String locale)

Properties

appTitle String
The title of the application
no setter
countries String
Countries button label
no setter
hashCode int
The hash code for this object.
no setterinherited
initializing String
Initialization status message
no setter
loading String
Loading indicator text
no setter
localeName String
final
nearestToBerlin String
Find nearest cities button label
no setter
noResults String
Message when there are no search results
no setter
radiusSearch String
Radius search button label
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
Search button label
no setter
searchHint String
Search field hint text
no setter
smartSearch String
Smart search button label
no setter
status String
Status label
no setter

Methods

failedFindCountries(String error) String
Error finding countries
failedFindNearest(String error) String
Error finding nearest cities
failedFindRadius(String error) String
Error finding cities in radius
foundCountries(int count) String
Message after finding countries
foundInRadius(int count) String
Message after finding cities in radius
foundNearest(int count) String
Message after finding nearest cities
initFailed(String error) String
Failed initialization error message
initSuccess(int countries, int states, int cities) String
Successful initialization message
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
searchFailed(String error) String
Search error message
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

of(BuildContext context) AppLocalizations?

Constants

delegate → const LocalizationsDelegate<AppLocalizations>
localizationsDelegates → const List<LocalizationsDelegate>
A list of this localizations delegate along with the default localizations delegates.
supportedLocales → const List<Locale>
A list of this localizations delegate's supported locales.