translateWithParams method

String translateWithParams(
  1. Map<String, String> params
)

Method that considers a string as a key from i18n and replace all the translation parameters params with their values and return the translated string.

Implementation

String translateWithParams(Map<String, String> params) {
  String self = KareeInternationalization
          .appLocalization.value.translation?[this]
          ?.toString() ??
      this;
  for (var entryParam in params.entries) {
    self = self.replaceAll('\${${entryParam.key}}', entryParam.value);
  }

  return self;
}