lemmur-app-android/lib/l10n/l10n.dart

17 lines
397 B
Dart
Raw Normal View History

2021-02-27 17:02:55 +01:00
import 'package:flutter/material.dart';
2021-02-27 14:39:58 +01:00
export 'package:flutter_gen/gen_l10n/l10n.dart';
2021-03-01 00:02:32 +01:00
export 'l10n_from_string.dart';
2021-02-27 17:02:55 +01:00
abstract class LocaleSerde {
static Locale fromJson(String json) {
if (json == null) return null;
final lang = json.split('-');
return Locale(lang[0], lang.length > 1 ? lang[1] : null);
}
static String toJson(Locale locale) => locale.toLanguageTag();
}