diff --git a/frontend/locale/de-de.all.json b/frontend/locale/de-de.all.json deleted file mode 100644 index 3d32f1e..0000000 --- a/frontend/locale/de-de.all.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "alert-secret-not-found": { - "other": "Das ist nicht das Secret, was du suchst\u0026hellip; - Falls du diesen Link noch nicht selbst geöffnet hast, könnte das Secret kompromittiert sein, da jemand anderes den Link geöffnet haben könnte." - }, - "alert-something-went-wrong": { - "other": "Irgendwas ging schief. Entschuldigung\u0026hellip;" - }, - "btn-create-secret": { - "other": "Secret erstellen!" - }, - "btn-new-secret": { - "other": "Neues Secret" - }, - "btn-reveal-secret": { - "other": "Zeig mir das Secret!" - }, - "label-secret-data": { - "other": "Inhalt des Secrets:" - }, - "text-burn-hint": { - "other": "Bitte rufe die URL nicht selbst auf, da das Secret dadurch zerstört würde. Gib sie einfach weiter!" - }, - "text-hint-burned": { - "other": "\u003cstrong\u003eAchtung:\u003c/strong\u003e Du kannst das nur einmal ansehen! Sobald du die Seite neu lädst, ist das Secret verschwunden, also besser direkt kopieren und sicher abspeichern\u0026hellip;" - }, - "text-powered-by": { - "other": "Läuft mit" - }, - "text-pre-reveal-hint": { - "other": "Um das Secret anzuzeigen klicke diesen Button aber denk dran, dass das Secret nur einmal angezeigt und dabei gelöscht wird." - }, - "text-pre-url": { - "other": "Dein Secret wurde angelegt und unter folgender URL gespeichert:" - }, - "title-new-secret": { - "other": "Erstelle ein neues Secret" - }, - "title-reading-secret": { - "other": "Secret auslesen\u0026hellip;" - }, - "title-secret-created": { - "other": "Secret erstellt!" - } -} \ No newline at end of file diff --git a/frontend/locale/en-us.all.json b/frontend/locale/en-us.all.json deleted file mode 100644 index 1b04511..0000000 --- a/frontend/locale/en-us.all.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "alert-secret-not-found": { - "other": "This is not the secret you are looking for\u0026hellip; - If you expected the secret to be here it might be comprimised as someone else might have opened the link already." - }, - "alert-something-went-wrong": { - "other": "Something went wrong. I'm very sorry about this\u0026hellip;" - }, - "btn-create-secret": { - "other": "Create the secret!" - }, - "btn-new-secret": { - "other": "New Secret" - }, - "btn-reveal-secret": { - "other": "Show me the secret!" - }, - "label-secret-data": { - "other": "Secret data:" - }, - "text-burn-hint": { - "other": "Please remember not to go to this URL yourself as that would destroy the secret. Just pass it to someone else!" - }, - "text-hint-burned": { - "other": "\u003cstrong\u003eAttention:\u003c/strong\u003e You're only seeing this once. As soon as you reload the page the secret will be gone so maybe copy it now\u0026hellip;" - }, - "text-powered-by": { - "other": "Powered by" - }, - "text-pre-reveal-hint": { - "other": "To reveal the secret click this button but be aware doing so will destroy the secret. You can only view it once!" - }, - "text-pre-url": { - "other": "Your secret was created and stored using this URL:" - }, - "title-new-secret": { - "other": "Create a new secret" - }, - "title-reading-secret": { - "other": "Reading your secret\u0026hellip;" - }, - "title-secret-created": { - "other": "Secret created!" - } -} \ No newline at end of file diff --git a/src/langs/de.json b/src/langs/de.json new file mode 100644 index 0000000..da95e75 --- /dev/null +++ b/src/langs/de.json @@ -0,0 +1,16 @@ +{ + "alert-secret-not-found": "Das ist nicht das Secret, was du suchst… - Falls du diesen Link noch nicht selbst geöffnet hast, könnte das Secret kompromittiert sein, da jemand anderes den Link geöffnet haben könnte.", + "alert-something-went-wrong": "Irgendwas ging schief. Entschuldigung…", + "btn-create-secret": "Secret erstellen!", + "btn-new-secret": "Neues Secret", + "btn-reveal-secret": "Zeig mir das Secret!", + "label-secret-data": "Inhalt des Secrets:", + "text-burn-hint": "Bitte rufe die URL nicht selbst auf, da das Secret dadurch zerstört würde. Gib sie einfach weiter!", + "text-hint-burned": "Achtung: Du kannst das nur einmal ansehen! Sobald du die Seite neu lädst, ist das Secret verschwunden, also besser direkt kopieren und sicher abspeichern…", + "text-powered-by": "Läuft mit", + "text-pre-reveal-hint": "Um das Secret anzuzeigen klicke diesen Button aber denk dran, dass das Secret nur einmal angezeigt und dabei gelöscht wird.", + "text-pre-url": "Dein Secret wurde angelegt und unter folgender URL gespeichert:", + "title-new-secret": "Erstelle ein neues Secret", + "title-reading-secret": "Secret auslesen…", + "title-secret-created": "Secret erstellt!" +} diff --git a/src/langs/en.json b/src/langs/en.json new file mode 100644 index 0000000..ce3b66c --- /dev/null +++ b/src/langs/en.json @@ -0,0 +1,16 @@ +{ + "alert-secret-not-found": "This is not the secret you are looking for… - If you expected the secret to be here it might be comprimised as someone else might have opened the link already.", + "alert-something-went-wrong": "Something went wrong. I'm very sorry about this…", + "btn-create-secret": "Create the secret!", + "btn-new-secret": "New Secret", + "btn-reveal-secret": "Show me the secret!", + "label-secret-data": "Secret data:", + "text-burn-hint": "Please remember not to go to this URL yourself as that would destroy the secret. Just pass it to someone else!", + "text-hint-burned": "Attention: You're only seeing this once. As soon as you reload the page the secret will be gone so maybe copy it now…", + "text-powered-by": "Powered by", + "text-pre-reveal-hint": "To reveal the secret click this button but be aware doing so will destroy the secret. You can only view it once!", + "text-pre-url": "Your secret was created and stored using this URL:", + "title-new-secret": "Create a new secret", + "title-reading-secret": "Reading your secret…", + "title-secret-created": "Secret created!" +} diff --git a/src/langs/langs.js b/src/langs/langs.js new file mode 100644 index 0000000..56c824a --- /dev/null +++ b/src/langs/langs.js @@ -0,0 +1,7 @@ +import lang_de from './de.json' +import lang_en from './en.json' + +export default { + de: lang_de, + en:lang_en, +} diff --git a/translations.go b/translations.go deleted file mode 100644 index f0fba49..0000000 --- a/translations.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -import ( - "net/http" - "strings" - "text/template" - - "github.com/nicksnyder/go-i18n/i18n" - log "github.com/sirupsen/logrus" -) - -func init() { - for _, filename := range AssetNames() { - if !strings.HasPrefix(filename, "frontend/locale") || !strings.HasSuffix(filename, ".all.json") { - continue - } - - translationData, _ := Asset(filename) - if err := i18n.ParseTranslationFileBytes(filename, translationData); err != nil { - log.Fatalf("Unable to load translation data %q: %s", filename, err) - } - } -} - -func addTranslateFunc(t template.FuncMap, r *http.Request) template.FuncMap { - cookie, _ := r.Cookie("lang") - - cookieLang := "" - if cookie != nil { - cookieLang = cookie.Value - } - qpLang := r.URL.Query().Get("hl") - acceptLang := r.Header.Get("Accept-Language") - defaultLang := "en-US" // known valid language - - T, _ := i18n.Tfunc(cookieLang, qpLang, acceptLang, defaultLang) - - t["T"] = T - return t -}