Skip to content

Commit

Permalink
Knytt i18n-navnerom til kode-navnerom
Browse files Browse the repository at this point in the history
  • Loading branch information
cjohansen committed Oct 20, 2023
1 parent 389ba83 commit ad906bf
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
18 changes: 9 additions & 9 deletions src/matvaretabellen/i18n/en.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"]
Expand All @@ -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)))
16 changes: 8 additions & 8 deletions src/matvaretabellen/i18n/nb.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"]
Expand All @@ -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)))
2 changes: 1 addition & 1 deletion src/matvaretabellen/pages/food_groups_page.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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])]
Expand Down
24 changes: 12 additions & 12 deletions src/matvaretabellen/pages/food_page.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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"}]})]]]]]]))
4 changes: 2 additions & 2 deletions src/matvaretabellen/pages/frontpage.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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"})]]]]])

0 comments on commit ad906bf

Please sign in to comment.