From fa20712d3ac6e0311ce703a34acb15984fada0b2 Mon Sep 17 00:00:00 2001 From: Timon Ringwald Date: Tue, 6 Sep 2022 15:09:02 +0200 Subject: [PATCH] fixed translation --- bookmarks.json | 262 ------------------------------------------------- text.go | 10 +- 2 files changed, 5 insertions(+), 267 deletions(-) delete mode 100644 bookmarks.json diff --git a/bookmarks.json b/bookmarks.json deleted file mode 100644 index eb513ed..0000000 --- a/bookmarks.json +++ /dev/null @@ -1,262 +0,0 @@ -[ - { - "title": "DuckDuckGo", - "image": "https://duckduckgo.com/assets/logo_homepage.alt.v108.svg", - "image_size": "", - "icon_padding": "", - "color": "#e37151", - "link": "https://duckduckgo.com/", - "hide_border": false, - "order": 0 - }, - { - "title": "Cloud", - "image": "https://cloud.tordarus.net/svg/core/logo/logo?color=ffffff\u0026v=1", - "image_size": "", - "icon_padding": "", - "color": "#007ec2", - "link": "https://cloud.tordarus.net/", - "hide_border": false, - "order": 0 - }, - { - "title": "ProtonMail", - "image": "https://protonmail.com/images/pm-logo-white.svg", - "image_size": "", - "icon_padding": "", - "color": "#253163", - "link": "https://protonmail.com/", - "hide_border": false, - "order": 0 - }, - { - "title": "Anilist", - "image": "https://anilist.co/img/icons/icon.svg", - "image_size": "", - "icon_padding": "0.5em", - "color": "#2b2d42", - "link": "https://anilist.co/", - "hide_border": false, - "order": 0 - }, - { - "title": "Torrents", - "image": "/transmission.png", - "image_size": "", - "icon_padding": "", - "color": "#e7402c", - "link": "https://torrents.tordarus.net/", - "hide_border": false, - "order": 0 - }, - { - "title": "Nyaa.si", - "image": "https://progsoft.net/images/nyaa-v2-icon-a591b5ae622eb38f31c00297cf9b53fd88c058ef.png", - "image_size": "111%", - "icon_padding": "0em", - "color": "#e7402c", - "link": "https://nyaa.si/", - "hide_border": false, - "order": 0 - }, - { - "title": "Adblock", - "image": "/pihole.svg", - "image_size": "", - "icon_padding": "", - "color": "#272c30", - "link": "https://adblock.tordarus.net/", - "hide_border": false, - "order": 0 - }, - { - "title": "Postbank", - "image": "https://wintouch.de/wp-content/uploads/2014/06/Postbank-Icon.png", - "image_size": "", - "icon_padding": "", - "color": "#ffcc00", - "link": "https://meine.postbank.de/", - "hide_border": false, - "order": 0 - }, - { - "title": "DKB", - "image": "https://vdiv-sa.de/wp-content/uploads/2016/08/DKB_AG_web_RGB.jpg", - "image_size": "", - "icon_padding": "", - "color": "#ffffff", - "link": "https://www.dkb.de/", - "hide_border": false, - "order": 0 - }, - { - "title": "Finanzen", - "image": "https://docs.firefly-iii.org/img/logo.png", - "image_size": "cover", - "icon_padding": "0em", - "color": "#ffffff", - "link": "https://finance.tordarus.net", - "hide_border": false, - "order": 0 - }, - { - "title": "YouTube", - "image": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/YouTube_light_icon_%282017%29.svg/1280px-YouTube_light_icon_%282017%29.svg.png", - "image_size": "", - "icon_padding": "1.5em", - "color": "#ff0000", - "link": "https://www.youtube.com/", - "hide_border": false, - "order": 0 - }, - { - "title": "Netflix", - "image": "https://1000logos.net/wp-content/uploads/2017/05/emblem-Netflix.jpg", - "image_size": "", - "icon_padding": "", - "color": "#000000", - "link": "https://www.netflix.com/", - "hide_border": false, - "order": 0 - }, - { - "title": "Jisho", - "image": "https://assets.jisho.org/assets/jisho-logo-v4@2x-7330091c079b9dd59601401b052b52e103978221c8fb6f5e22406d871fcc746a.png", - "image_size": "", - "icon_padding": "", - "color": "#ffffff", - "link": "https://jisho.org/", - "hide_border": false, - "order": 0 - }, - { - "title": "Wadoku", - "image": "https://www.wadoku.de/img/wadoku_logo.svg", - "image_size": "", - "icon_padding": "", - "color": "#ffffff", - "link": "https://www.wadoku.de/", - "hide_border": false, - "order": 0 - }, - { - "title": "Übersetzer", - "image": "https://tools.avans.nl/tools/image/wZkdyaMblN.jpg", - "image_size": "cover", - "icon_padding": "0em", - "color": "#042b48", - "link": "https://www.deepl.com/translator", - "hide_border": false, - "order": 0 - }, - { - "title": "WaniKani", - "image": "https://assets.wanikani.com/assets/logo--retro-colors-b79775af8773b5a416e4ec3fae02e62d391b7e88e57f9fe0c2e4997a3383b002.png", - "image_size": "", - "icon_padding": "", - "color": "#ffffff", - "link": "https://www.wanikani.com/", - "hide_border": false, - "order": 0 - }, - { - "title": "Passwörter", - "image": "https://raw.githubusercontent.com/dani-garcia/vaultwarden/main/resources/vaultwarden-logo-white.svg", - "image_size": "", - "icon_padding": "", - "color": "#175ddc", - "link": "https://pw.tordarus.net", - "hide_border": false, - "order": 0 - }, - { - "title": "Projekte", - "image": "/gitea.png", - "image_size": "cover", - "icon_padding": "0em", - "color": "#609926", - "link": "https://git.tordarus.net", - "hide_border": false, - "order": 0 - }, - { - "title": "Regexr", - "image": "https://raw.githubusercontent.com/gskinner/regexr/master/dev/icons/RegExr.svg", - "image_size": "contain", - "icon_padding": "0em", - "color": "#101112", - "link": "https://regex.tordarus.net", - "hide_border": false, - "order": 0 - }, - { - "title": "Wikipedia", - "image": "https://upload.wikimedia.org/wikipedia/commons/8/80/Wikipedia-logo-v2.svg", - "image_size": "", - "icon_padding": "", - "color": "#ffffff", - "link": "https://www.wikipedia.org/", - "hide_border": false, - "order": 0 - }, - { - "title": "Reddit", - "image": "https://www.redditinc.com/assets/images/site/reddit-logo.png", - "image_size": "cover", - "icon_padding": "0em", - "color": "#ff4300", - "link": "https://www.reddit.com/", - "hide_border": false, - "order": 0 - }, - { - "title": "Tagesschau", - "image": "https://m47ch.com/wp-content/uploads/2010/12/Tagesschau.png", - "image_size": "", - "icon_padding": "", - "color": "#003f8c", - "link": "https://www.tagesschau.de/", - "hide_border": false, - "order": 0 - }, - { - "title": "Golem", - "image": "https://www.golem.de/staticrl/images/golem-logo-opt2.svg", - "image_size": "", - "icon_padding": "", - "color": "#000000", - "link": "https://www.golem.de/", - "hide_border": false, - "order": 0 - }, - { - "title": "Comico", - "image": "https://play-lh.googleusercontent.com/xZ5bfg-XfyEmM1641bXduE27w44OmyWeVspg626wRYF0ejAgZAvsRKP4sECblfmnpg=w512", - "image_size": "cover", - "icon_padding": "0em", - "color": "#f40000", - "link": "https://comico.jp/", - "hide_border": false, - "order": 0 - }, - { - "title": "Manganelo", - "image": "https://manganato.com/themes/hm/images/logo.png", - "image_size": "contain", - "icon_padding": "0em", - "color": "#ffffff", - "link": "https://manganato.com/", - "hide_border": false, - "order": 0 - }, - { - "title": "Manga List", - "image": "https://www.firstcomicsnews.com/wp-content/uploads/2020/09/manga-logo.png", - "image_size": "", - "icon_padding": "", - "color": "#be151b", - "link": "https://manga.tordarus.net/", - "hide_border": false, - "order": 0 - } -] diff --git a/text.go b/text.go index 7ad7870..8398dc3 100644 --- a/text.go +++ b/text.go @@ -19,8 +19,8 @@ func (t *Text) Translate(str string) string { } var ( - Languages = map[language.Tag]Text{ - language.English: { + Languages = map[string]Text{ + "en": { Strings: map[string]string{ "Homepage": "Homepage", "Search": "Search", @@ -32,7 +32,7 @@ var ( }, }, - language.German: { + "de": { Strings: map[string]string{ "Homepage": "Homepage", "Search": "Suche", @@ -44,7 +44,7 @@ var ( }, }, - language.Japanese: { + "ja": { Strings: map[string]string{ "Homepage": "ホームページ", "Search": "検索", @@ -66,8 +66,8 @@ var languageMatcher = language.NewMatcher([]language.Tag{ func GetText(r *http.Request) *Text { lang, _ := language.MatchStrings(languageMatcher, r.Header.Get("Accept-Language")) - text := Languages[lang] base, _ := lang.Base() + text := Languages[base.String()] text.Language = base.String() return &text }