182 lines
8.8 KiB
Go
182 lines
8.8 KiB
Go
// Code generated by go-localize; DO NOT EDIT.
|
|
// This file was generated by robots at
|
|
// 2021-05-12 16:40:11.262748016 -0600 MDT m=+0.001520368
|
|
|
|
package localizations
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"strings"
|
|
"text/template"
|
|
)
|
|
|
|
var localizations = map[string]string{
|
|
"en-US.errors.bad_command": "Unrecognized Command.",
|
|
"en-US.errors.bad_content_type": "Unintelligible content type: {{.mime}}",
|
|
"en-US.errors.bad_feed": "Cannot interpret {{.meta}} as a feed",
|
|
"en-US.errors.core_init": "Error in initialization: {{.error}}",
|
|
"en-US.errors.corrupt_json_error": "comitium.json is corrupted: {{.error}}",
|
|
"en-US.errors.gem_bad_response": "Unexpected Gemini response {{.code}} {{.meta}}",
|
|
"en-US.errors.gopher_no_extract": "Gemini-style feeds served over gopher are currently unsupported.",
|
|
"en-US.errors.http_bad_repsonse": "Unexpected HTTP response {{.status}}",
|
|
"en-US.errors.http_no_extract": "Extracting feed from HTML pages is currently unsupported.",
|
|
"en-US.errors.no_argument": "{{.command}} doesn't take an argument!",
|
|
"en-US.errors.no_command": "Please provide a command.",
|
|
"en-US.errors.no_data_dir": "Error finding a suitable directory! Falling back to the current working directory. See \"comitium help\" or comitium(1) for more information.",
|
|
"en-US.errors.no_url_add": "Please provide a URL to add.",
|
|
"en-US.errors.no_url_remove": "Please provide a URL to remove.",
|
|
"en-US.errors.read_file_error": "error reading '{{.file}}': {{.error}}",
|
|
"en-US.errors.saving": "Error writing '{{.file}}': {{.error}}",
|
|
"en-US.errors.unsupported_protocol": "Unsupported protocol '{{.scheme}}'",
|
|
"en-US.errors.url_add": "Error adding URL: {{.error}}",
|
|
"en-US.errors.url_parse": "Error parsing URL: {{.error}}",
|
|
"en-US.errors.version": "comitium v{{.version}}, commit {{.commit}}",
|
|
"en-US.files.comitium_footer": "aggregated using comitium v{{.version}}-{{.commit}}",
|
|
"en-US.files.feed_default_header": "comitium subscriptions",
|
|
"en-US.files.feed_subscriptions_link": "Currently aggregating {{.num}} capsules, gopherholes, and websites.",
|
|
"en-US.files.generated_on": "Generated on {{.date}}",
|
|
"en-US.files.subscriptions_feeds_subtitle": "Gemini, Atom, RSS, and JSON feeds from all over.",
|
|
"en-US.files.subscriptions_feeds_title": "feeds",
|
|
"en-US.files.subscriptions_pages_subtitle": "Watching these pages for any changes that occur.",
|
|
"en-US.files.subscriptions_pages_title": "pages",
|
|
"en-US.files.subscriptions_subscribed_feeds": "subscribed feeds",
|
|
"fr-FR.errors.bad_command": "Commande inconue.",
|
|
"fr-FR.errors.bad_content_type": "Type de contenu inintelligible: {{.mime}}",
|
|
"fr-FR.errors.bad_feed": "{{.meta}} n'est pas un flux reconnu",
|
|
"fr-FR.errors.core_init": "Erreur d'initialisation: {{.error}}",
|
|
"fr-FR.errors.corrupt_json_error": "comitium.json est corrompu: {{.error}}",
|
|
"fr-FR.errors.gem_bad_response": "Réponse Gemini non attendue {{.code}} {{.meta}}",
|
|
"fr-FR.errors.gopher_no_extract": "Les flux Gemini publiés via Gopher ne sont actuellement pas pris en charge.",
|
|
"fr-FR.errors.http_bad_repsonse": "Réponse HTTP inattendue {{.status}}",
|
|
"fr-FR.errors.http_no_extract": "L'extraction du flux à partir de pages HTML n'est actuellement pas prise en charge.",
|
|
"fr-FR.errors.no_argument": "{{.command}} ne prend pas d'argument!",
|
|
"fr-FR.errors.no_command": "Please provide a command.",
|
|
"fr-FR.errors.no_data_dir": "Erreur lors de la recherche d'un répertoire approprié! Revenir au répertoire de travail actuel. Voir \"comitium help\" ou comitium (1) pour plus d'informations",
|
|
"fr-FR.errors.no_url_add": "Merci d'indiquer une URL à ajouter.",
|
|
"fr-FR.errors.no_url_remove": "Merci d'indiquer une URL à supprimer.",
|
|
"fr-FR.errors.read_file_error": "erreur lors de la lecture de '{{.file}}': {{.error}}",
|
|
"fr-FR.errors.saving": "erreur lors de l'écriture de '{{.file}}': {{.error}}",
|
|
"fr-FR.errors.unsupported_protocol": "Protocol non supporté '{{.scheme}}'",
|
|
"fr-FR.errors.url_add": "Erreur lors de l'ajout de l'URL: {{.error}}",
|
|
"fr-FR.errors.url_parse": "Erreur lors de l'analyse de l'URL: {{.error}}",
|
|
"fr-FR.errors.version": "comitium v{{.version}}, commit {{.commit}}",
|
|
"fr-FR.files.comitium_footer": "Agrégé par comitium v{{.version}}-{{.commit}}",
|
|
"fr-FR.files.feed_default_header": "Flux abonnés via comitium",
|
|
"fr-FR.files.feed_subscriptions_link": "{{.num}} capsules, gopherholes et sites internet sont agrégés.",
|
|
"fr-FR.files.generated_on": "Généré le {{.date}}",
|
|
"fr-FR.files.subscriptions_feeds_subtitle": "Tous les flux Gemini, Atom, RSS et JSON.",
|
|
"fr-FR.files.subscriptions_feeds_title": "flux",
|
|
"fr-FR.files.subscriptions_pages_subtitle": "Ces pages sont surveillées pour tout changement.",
|
|
"fr-FR.files.subscriptions_pages_title": "pages",
|
|
"fr-FR.files.subscriptions_subscribed_feeds": "Abonnements",
|
|
"it-IT.errors.bad_command": "Comando non riconosciuto.",
|
|
"it-IT.errors.bad_content_type": "Tipo di contenuto non intelligibile: {{.mime}}",
|
|
"it-IT.errors.bad_feed": "Impossibile interpretare {{.meta}} come un feed",
|
|
"it-IT.errors.core_init": "Errore nell'inizializzazione: {{.error}}",
|
|
"it-IT.errors.corrupt_json_error": "comitium.json è corrotto: {{.error}}",
|
|
"it-IT.errors.gem_bad_response": "Risposta Gemini inaspettata {{.code}} {{.meta}}",
|
|
"it-IT.errors.gopher_no_extract": "I feed nello stile di Gemini serviti tramite gopher al momento non sono supportati.",
|
|
"it-IT.errors.http_bad_repsonse": "Risposta HTTP inaspettata {{.status}}",
|
|
"it-IT.errors.http_no_extract": "L'estrazione di feed dalle pagine HTML al momento non è supportata.",
|
|
"it-IT.errors.no_argument": "{{.command}} non prende nessun argomento!",
|
|
"it-IT.errors.no_command": "Per favore fornire un comando.",
|
|
"it-IT.errors.no_data_dir": "Errore durante la ricerca di una directory adatta! È stata scelta la directory attuale come ripiego. Vedere \"comitium help\" oppure la manpage comitium(1) per maggiori informazioni.",
|
|
"it-IT.errors.no_url_add": "Per favore fornire un URL da aggiungere.",
|
|
"it-IT.errors.no_url_remove": "Per favore fornire un URL da rimuovere.",
|
|
"it-IT.errors.read_file_error": "Errore durante la lettura di '{{.file}}': {{.error}}",
|
|
"it-IT.errors.saving": "Errore nella scrittura di '{{.file}}': {{.error}}",
|
|
"it-IT.errors.unsupported_protocol": "Protocollo non supportato '{{.scheme}}'",
|
|
"it-IT.errors.url_add": "Errore nell'aggiunta del URL: {{.error}}",
|
|
"it-IT.errors.url_parse": "Errore durante il parsing del URL: {{.error}}",
|
|
"it-IT.errors.version": "comitium v{{.version}}, commit {{.commit}}",
|
|
"it-IT.files.comitium_footer": "aggregato usando comitium v{{.version}}-{{.commit}}",
|
|
"it-IT.files.feed_default_header": "iscrizioni comitium",
|
|
"it-IT.files.feed_subscriptions_link": "Attualmente ci sono {{.num}} capsule, gopherhole e siti web aggregati.",
|
|
"it-IT.files.generated_on": "Generato il {{.date}}",
|
|
"it-IT.files.subscriptions_feeds_subtitle": "Feed Gemini, Atom, RSS e JSON tutti insieme.",
|
|
"it-IT.files.subscriptions_feeds_title": "feed",
|
|
"it-IT.files.subscriptions_pages_subtitle": "Pagine seguite per controllarne le modifiche.",
|
|
"it-IT.files.subscriptions_pages_title": "pagine",
|
|
"it-IT.files.subscriptions_subscribed_feeds": "feed seguiti",
|
|
}
|
|
|
|
type Replacements map[string]interface{}
|
|
|
|
type Localizer struct {
|
|
Locale string
|
|
FallbackLocale string
|
|
Localizations map[string]string
|
|
}
|
|
|
|
func New(locale string, fallbackLocale string) *Localizer {
|
|
t := &Localizer{Locale: locale, FallbackLocale: fallbackLocale}
|
|
t.Localizations = localizations
|
|
return t
|
|
}
|
|
|
|
func (t Localizer) SetLocales(locale, fallback string) Localizer {
|
|
t.Locale = locale
|
|
t.FallbackLocale = fallback
|
|
return t
|
|
}
|
|
|
|
func (t Localizer) SetLocale(locale string) Localizer {
|
|
t.Locale = locale
|
|
return t
|
|
}
|
|
|
|
func (t Localizer) SetFallbackLocale(fallback string) Localizer {
|
|
t.FallbackLocale = fallback
|
|
return t
|
|
}
|
|
|
|
func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacements) string {
|
|
str, ok := t.Localizations[t.getLocalizationKey(locale, key)]
|
|
if !ok {
|
|
str, ok = t.Localizations[t.getLocalizationKey(t.FallbackLocale, key)]
|
|
if !ok {
|
|
return key
|
|
}
|
|
}
|
|
|
|
// If the str doesn't have any substitutions, no need to
|
|
// template.Execute.
|
|
if strings.Index(str, "}}") == -1 {
|
|
return str
|
|
}
|
|
|
|
return t.replace(str, replacements...)
|
|
}
|
|
|
|
func (t Localizer) Get(key string, replacements ...*Replacements) string {
|
|
str := t.GetWithLocale(t.Locale, key, replacements...)
|
|
return str
|
|
}
|
|
|
|
func (t Localizer) getLocalizationKey(locale string, key string) string {
|
|
return fmt.Sprintf("%v.%v", locale, key)
|
|
}
|
|
|
|
func (t Localizer) replace(str string, replacements ...*Replacements) string {
|
|
b := &bytes.Buffer{}
|
|
tmpl, err := template.New("").Parse(str)
|
|
if err != nil {
|
|
return str
|
|
}
|
|
|
|
replacementsMerge := Replacements{}
|
|
for _, replacement := range replacements {
|
|
for k, v := range *replacement {
|
|
replacementsMerge[k] = v
|
|
}
|
|
}
|
|
|
|
err = template.Must(tmpl, err).Execute(b, replacementsMerge)
|
|
if err != nil {
|
|
return str
|
|
}
|
|
buff := b.String()
|
|
return buff
|
|
}
|