summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/core.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/core.go b/core/core.go
index d35f9bf..feeaf9c 100644
--- a/core/core.go
+++ b/core/core.go
@@ -121,3 +121,11 @@ func (d *FullData) WriteJSON(dataPath string) error {
err = os.Rename(path, filepath.Join(dataPath, "comitium.json"))
return err
}
+
+// TranslateString takes a template string, a localizer tag, and a localizer
+// replacement set and will get the localized string from the localizer tag,
+// replace everything using the localizer replacements, and then substitute that
+// string into the template string.
+func TranslateString(template, localizerTag string, replacements *localizations.Replacements) string {
+ return fmt.Sprintf(template, Localizer.Get(localizerTag, replacements))
+}