forked from baron/baron-sso
모바일 로그인창 테스트 강화
This commit is contained in:
@@ -10,45 +10,36 @@ class TomlAssetLoader extends AssetLoader {
|
||||
@override
|
||||
Future<Map<String, dynamic>> load(String path, Locale locale) async {
|
||||
final languageCode = locale.languageCode.toLowerCase();
|
||||
final source = switch (languageCode) {
|
||||
'ko' => koStrings,
|
||||
'en' => enStrings,
|
||||
_ => enStrings,
|
||||
return switch (languageCode) {
|
||||
'ko' => _normalizedKoStrings,
|
||||
'en' => _normalizedEnStrings,
|
||||
_ => _normalizedEnStrings,
|
||||
};
|
||||
return _expandFlatTranslations(source);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> _expandFlatTranslations(Map<String, String> flatMap) {
|
||||
final nested = <String, dynamic>{};
|
||||
for (final entry in flatMap.entries) {
|
||||
final key = entry.key;
|
||||
if (key.isEmpty) {
|
||||
continue;
|
||||
}
|
||||
final segments = key.split('.');
|
||||
Map<String, dynamic> cursor = nested;
|
||||
for (var index = 0; index < segments.length; index++) {
|
||||
final segment = segments[index];
|
||||
if (segment.isEmpty) {
|
||||
continue;
|
||||
}
|
||||
final isLeaf = index == segments.length - 1;
|
||||
if (isLeaf) {
|
||||
cursor[segment] = _normalizeLocalizationValue(entry.value);
|
||||
continue;
|
||||
}
|
||||
final next = cursor.putIfAbsent(segment, () => <String, dynamic>{});
|
||||
if (next is Map<String, dynamic>) {
|
||||
cursor = next;
|
||||
continue;
|
||||
}
|
||||
final replacement = <String, dynamic>{};
|
||||
cursor[segment] = replacement;
|
||||
cursor = replacement;
|
||||
}
|
||||
}
|
||||
return nested;
|
||||
final Map<String, dynamic> _normalizedKoStrings = _normalizeFlatTranslations(
|
||||
koStrings,
|
||||
);
|
||||
final Map<String, dynamic> _normalizedEnStrings = _normalizeFlatTranslations(
|
||||
enStrings,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _normalizeFlatTranslations(Map<String, String> flatMap) =>
|
||||
Map.fromEntries(
|
||||
flatMap.entries
|
||||
.where((entry) => _isUserfrontTranslationKey(entry.key))
|
||||
.map(
|
||||
(entry) =>
|
||||
MapEntry(entry.key, _normalizeLocalizationValue(entry.value)),
|
||||
),
|
||||
);
|
||||
|
||||
bool _isUserfrontTranslationKey(String key) {
|
||||
return key.startsWith('domain.') ||
|
||||
key.startsWith('msg.userfront.') ||
|
||||
key.startsWith('ui.userfront.') ||
|
||||
key.startsWith('ui.common.');
|
||||
}
|
||||
|
||||
String _normalizeLocalizationValue(String value) {
|
||||
|
||||
@@ -1781,7 +1781,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
style: theme.textTheme.headlineMedium?.copyWith(
|
||||
fontSize: 34,
|
||||
fontWeight: FontWeight.w800,
|
||||
letterSpacing: -0.7,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user