mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-11 01:35:27 +00:00
.github
android
assets
ios
lib
generated
inventree
l10n
settings
widget
api.dart
api_form.dart
app_colors.dart
barcode.dart
dummy_dsn.dart
helpers.dart
l10.dart
main.dart
preferences.dart
user_profile.dart
res
test
.gitignore
.gitmodules
.metadata
LICENSE
README.md
RELEASE.md
analysis_options.yaml
crowdin.yml
find_dart_files.py
l10n.yaml
pubspec.lock
pubspec.yaml
requirements.txt
24 lines
530 B
Dart
24 lines
530 B
Dart
import "package:flutter_gen/gen_l10n/app_localizations.dart";
|
|
import "package:flutter_gen/gen_l10n/app_localizations_en.dart";
|
|
|
|
import "package:one_context/one_context.dart";
|
|
import "package:flutter/material.dart";
|
|
|
|
// Shortcut function to reduce boilerplate!
|
|
I18N L10()
|
|
{
|
|
if (OneContext.hasContext) {
|
|
BuildContext? _ctx = OneContext().context;
|
|
|
|
if (_ctx != null) {
|
|
I18N? i18n = I18N.of(_ctx);
|
|
|
|
if (i18n != null) {
|
|
return i18n;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Fallback for "null" context
|
|
return I18NEn();
|
|
} |