depending on the path a different language is pre-selected
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user