depending on the path a different language is pre-selected

This commit is contained in:
2024-12-18 19:41:00 +01:00
parent 6587828a0b
commit b66da23887
3 changed files with 20 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class Tools {
Tools._();
/// Builds a formatted time string from two date strings in the format 'YYYY-MM'.
///
/// Returns a string in the format 'Month Year - Month Year' using localized month names.
@@ -94,4 +96,13 @@ class Tools {
throw ArgumentError('Month number must be between 1 and 12');
}
}
static String getLocaleFromPath(String path) {
if (path.startsWith('/de')) {
return 'de';
} else if (path.startsWith('/en')) {
return 'en';
}
return 'de'; // Default fallback
}
}