From ad906bf1ac2f67572022f4be00609600eaadc225 Mon Sep 17 00:00:00 2001 From: Christian Johansen Date: Thu, 19 Oct 2023 14:43:54 +0200 Subject: [PATCH] Knytt i18n-navnerom til kode-navnerom --- src/matvaretabellen/i18n/en.clj | 18 +++++++------- src/matvaretabellen/i18n/nb.clj | 16 ++++++------- .../pages/food_groups_page.clj | 2 +- src/matvaretabellen/pages/food_page.clj | 24 +++++++++---------- src/matvaretabellen/pages/frontpage.clj | 4 ++-- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/matvaretabellen/i18n/en.clj b/src/matvaretabellen/i18n/en.clj index dd50df2..b5f7d46 100644 --- a/src/matvaretabellen/i18n/en.clj +++ b/src/matvaretabellen/i18n/en.clj @@ -2,19 +2,14 @@ (def dictionary (->> - [#:frontpage - {:search-button "Search" - :search-label "Search in Matvaretabellen" - } - - #:matvaretabellen.crumbs + [#:matvaretabellen.crumbs {:all-food-groups "All Food Groups" :food-groups-url "/food-groups/" :home "Home" :search-label "Search in Matvaretabellen" } - #:food + #:matvaretabellen.pages.food-page {:adi-title "Recommended Daily Intake (ADI)" :carbohydrates-title "Carbohydrates" :category [:fn/str "Category: {{:category}}"] @@ -29,6 +24,11 @@ :vitamins-title "Vitamins" } - #:food-groups - {:all-food-groups "All Food Groups"}] + #:matvaretabellen.pages.food-groups-page + {:all-food-groups "All Food Groups"} + + #:matvaretabellen.pages.frontpage + {:search-button "Search" + :search-label "Search in Matvaretabellen" + }] (apply merge))) diff --git a/src/matvaretabellen/i18n/nb.clj b/src/matvaretabellen/i18n/nb.clj index b2811f1..dd58092 100644 --- a/src/matvaretabellen/i18n/nb.clj +++ b/src/matvaretabellen/i18n/nb.clj @@ -2,19 +2,14 @@ (def dictionary (->> - [#:frontpage - {:search-label "Søk i Matvaretabellen" - :search-button "Søk" - } - - #:matvaretabellen.crumbs + [#:matvaretabellen.crumbs {:all-food-groups "Alle matvaregrupper" :food-groups-url "/matvaregrupper/" :home "Hjem" :search-label "Søk i Matvaretabellen" } - #:food + #:matvaretabellen.pages.food-page {:adi-title "Anbefalt daglig inntak (ADI)" :carbohydrates-title "Karbohydrater" :category [:fn/str "Kategori: {{:category}}"] @@ -29,7 +24,12 @@ :vitamins-title "Vitaminer" } - #:food-groups + #:matvaretabellen.pages.food-groups-page {:all-food-groups "Alle matvaregrupper" + } + + #:matvaretabellen.pages.frontpage + {:search-label "Søk i Matvaretabellen" + :search-button "Søk" }] (apply merge))) diff --git a/src/matvaretabellen/pages/food_groups_page.clj b/src/matvaretabellen/pages/food_groups_page.clj index 562a35b..5cd2d89 100644 --- a/src/matvaretabellen/pages/food_groups_page.clj +++ b/src/matvaretabellen/pages/food_groups_page.clj @@ -25,7 +25,7 @@ {:text [:i18n ::crumbs/all-food-groups]})})]] [:div.mvt-hero-banner [:div.container - [:h1.h1 [:i18n :food-groups/all-food-groups]] + [:h1.h1 [:i18n ::all-food-groups]] [:div.mvt-cards.mtl (for [child food-groups] (let [the-name (get-in child [:food-group/name locale])] diff --git a/src/matvaretabellen/pages/food_page.clj b/src/matvaretabellen/pages/food_page.clj index dfb02fc..4d0905b 100644 --- a/src/matvaretabellen/pages/food_page.clj +++ b/src/matvaretabellen/pages/food_page.clj @@ -25,23 +25,23 @@ [:div {:style {:flex "1"}} [:h1.h1 food-name] [:div.intro.mtl - [:div [:i18n :food/food-id {:id (:food/id food)}]] - [:div [:i18n :food/category {:category (get-in food [:food/food-group :food-group/name locale])}] ] - [:div [:i18n :food/latin-name {:food/latin-name (:food/latin-name food)}]]]] - (Toc {:title [:i18n :food/toc-title] - :contents [{:title [:i18n :food/nutrition-title] + [:div [:i18n ::food-id {:id (:food/id food)}]] + [:div [:i18n ::category {:category (get-in food [:food/food-group :food-group/name locale])}] ] + [:div [:i18n ::latin-name {:food/latin-name (:food/latin-name food)}]]]] + (Toc {:title [:i18n ::toc-title] + :contents [{:title [:i18n ::nutrition-title] :href "#naeringsinnhold" - :contents [{:title [:i18n :food/energy-title] + :contents [{:title [:i18n ::energy-title] :href "#energi"} - {:title [:i18n :food/fat-title] + {:title [:i18n ::fat-title] :href "#fett"} - {:title [:i18n :food/carbohydrates-title] + {:title [:i18n ::carbohydrates-title] :href "#karbohydrater"} - {:title [:i18n :food/vitamins-title] + {:title [:i18n ::vitamins-title] :href "#vitaminer"} - {:title [:i18n :food/minerals-title] + {:title [:i18n ::minerals-title] :href "#mineraler"}]} - {:title [:i18n :food/adi-title] + {:title [:i18n ::adi-title] :href "#adi"} - {:title [:i18n :food/description-title] + {:title [:i18n ::description-title] :href "#beskrivelse"}]})]]]]]])) diff --git a/src/matvaretabellen/pages/frontpage.clj b/src/matvaretabellen/pages/frontpage.clj index 465d41b..d57136c 100644 --- a/src/matvaretabellen/pages/frontpage.clj +++ b/src/matvaretabellen/pages/frontpage.clj @@ -14,7 +14,7 @@ {:links (crumbs/crumble (:page/locale page))})] [:div.container.mtl [:div.search-input-wrap - (SearchInput {:label [:i18n :frontpage/search-label] - :button {:text [:i18n :frontpage/search-button]} + (SearchInput {:label [:i18n ::search-label] + :button {:text [:i18n ::search-button]} :input {:name "foods-search"} :autocomplete-id "foods-results"})]]]]])