2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00
inventree-app/lib/l10.dart
Oliver cfc9f09b80 Merge pull request #135 from inventree/unit-testing
Unit testing

(cherry picked from commit d55f594342e07fe142fdceda76a36ee0138d270f)
2022-05-22 10:12:16 +10:00

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();
}