removeTranslation method
Removes a translation and its associated keys from the internal map, triggering a UI rebuild.
Implementation
void removeTranslation(
BuildContext context, SupportedTranslation translation) {
logger.log("Attempting to remove translation: ${translation.name}");
rootBundle.loadString(translation.path).then((jsonString) {
Map<String, dynamic> jsonMap = json.decode(jsonString);
List<String> keysToRemove = jsonMap.keys.toList();
keysToRemove.forEach((key) {
_localizedStrings.remove(key);
logger.log("Removed key: $key from translation: ${translation.name}");
});
_includedTranslations.remove(translation.name);
logger.log("Translation removed: ${translation.name}");
(context as Element).markNeedsBuild();
}).catchError((error) {
logger.log("Error removing translation: ${error.toString()}");
});
}