From d1e38e90d461611daadc9d4528a0c9c3db709634 Mon Sep 17 00:00:00 2001
From: Henrik Askjer <henrik.askjer@uib.no>
Date: Thu, 13 Jan 2022 09:02:51 +0100
Subject: [PATCH] use locale on inflection button

---
 src/components/ArticleFooter.vue    | 18 +++++++++---------
 src/components/InflectionButton.vue |  8 +-------
 src/locales/nob.json                |  4 +++-
 3 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/components/ArticleFooter.vue b/src/components/ArticleFooter.vue
index e6230cdb..324ec752 100644
--- a/src/components/ArticleFooter.vue
+++ b/src/components/ArticleFooter.vue
@@ -14,17 +14,17 @@
 
       <v-btn v-if="showLinkCopy"
              small text class="toolbar-button" rounded @click="copy_link">
-        <v-icon small left>link</v-icon><span class = "button-text">{{$t("article_footer.copy_link")}}</span>
+        <v-icon small left>link</v-icon><span class = "button-text">{{$t("article.copy_link")}}</span>
       </v-btn>
 
       <v-btn v-if="webShareApiSupported" text small class="toolbar-button" rounded @click="shareViaWebShare">
-        <v-icon small left>share</v-icon><span class = "button-text">{{$t("article_footer.share")}}</span>
+        <v-icon small left>share</v-icon><span class = "button-text">{{$t("article.share")}}</span>
       </v-btn>
 
       <v-dialog max-width="600px" v-model="citation_dialog">
         <template v-slot:activator="{ on, attrs }">
             <v-btn text small class="toolbar-button" rounded v-on="on" v-bind="attrs">
-        <v-icon left small>format_quote</v-icon> <span class = "button-text">{{$t("article_footer.cite")}}</span>
+        <v-icon left small>format_quote</v-icon> <span class = "button-text">{{$t("article.cite")}}</span>
       </v-btn>
       
 
@@ -35,16 +35,16 @@
             <v-toolbar-title>Sitere artikkelen</v-toolbar-title>
             <v-spacer></v-spacer><v-toolbar-items><v-btn :aria-label="$t('article_footer.cancel')" @click="close_citation_dialog" text>{{$t('close')}}<v-icon right>close</v-icon></v-btn></v-toolbar-items></v-toolbar>
           <v-card-text class="text--primary">
-          {{$t("article_footer.description")}}
+          {{$t("article.description")}}
           <br/>
           <div id = "citation" v-html="this.create_citation()"/>
           </v-card-text>
           <v-card-actions>
           <v-btn depressed small rounded @click="copy_citation"><br>
-            <v-icon left small icon>content_copy</v-icon>  <span class = "button-text">{{$t("article_footer.copy")}}</span>
+            <v-icon left small icon>content_copy</v-icon>  <span class = "button-text">{{$t("article.copy")}}</span>
           </v-btn>
                     <v-btn depressed small rounded @click="download_ris"><br>
-            <v-icon left small icon>get_app</v-icon> <span class = "button-text">{{$t("article_footer.download")}}</span>
+            <v-icon left small icon>get_app</v-icon> <span class = "button-text">{{$t("article.download")}}</span>
           </v-btn>
                     
           </v-card-actions>
@@ -104,7 +104,7 @@ export default {
     },
     create_citation() {
       const [lemma, dd, mm, yyyy, link] = this.get_citation_info()
-      let citation = this.$t("article_footer.citation", {lemma, link, dd, mm, yyyy})
+      let citation = this.$t("article.citation", {lemma, link, dd, mm, yyyy})
 
       return citation
     },
@@ -112,7 +112,7 @@ export default {
       let link = this.create_link()
       let self = this
          navigator.clipboard.writeText(link).then(() => {
-           self.what_copied = this.$t("article_footer.link_copied")
+           self.what_copied = this.$t("article.link_copied")
            self.copy_popup = true
          }).catch(err => {
            console.log("ERROR COPYING:",err)
@@ -124,7 +124,7 @@ export default {
       let citation = document.getElementById("citation").textContent;
       navigator.clipboard.writeText(citation)
       this.citation_dialog = false
-      this.what_copied = this.$t("article_footer.citation_copied")
+      this.what_copied = this.$t("article.citation_copied")
       this.copy_popup = true
     },
 
diff --git a/src/components/InflectionButton.vue b/src/components/InflectionButton.vue
index 90ac2c2c..183ffb3b 100644
--- a/src/components/InflectionButton.vue
+++ b/src/components/InflectionButton.vue
@@ -4,7 +4,7 @@
       <div class="inflection-wrapper" v-if="inflected && !$parent.collapsed">
     
     <v-btn class="show-inflection" width="160px" rounded depressed small @click.native="toggle" :class="$vuetify.breakpoint.name">
-    <span>{{inflection_button_text}}</span><span class = "inflection-arrow"><v-icon right>{{inflection_arrow}}</v-icon></span>
+    <span>{{this.inflection_expanded? $t('article.hide_inflection'):$t('article.show_inflection')}}</span><span class = "inflection-arrow"><v-icon right>{{inflection_arrow}}</v-icon></span>
     </v-btn>
       <div class="inflection-canvas" v-if="inflection_expanded">
         <inflectionTable :lemmaList="lemmas_with_word_class_and_lang" :mq="$vuetify.breakpoint.name" />
@@ -30,12 +30,6 @@ export default {
     inflect_tooltip: function() {
       return this.dictionary == 'bm' ? 'Klikk for å se bøyinger' : 'Klikk for å sjå bøyingar'
     },
-    inflection_button_text: function() {
-      return {
-        "bm": {false: "Se bøyning", true: "Skjul bøyning"},
-        "nn": {false: "Sjå bøying", true: "Skjul bøying"}
-      }[this.dictionary][this.inflection_expanded]
-    },
     inflection_arrow: function() {
       return this.inflection_expanded?  "expand_less" : "expand_more"
     },
diff --git a/src/locales/nob.json b/src/locales/nob.json
index fa4a0e57..72872aed 100644
--- a/src/locales/nob.json
+++ b/src/locales/nob.json
@@ -29,7 +29,9 @@
       "locale": "Brukergrensesnitt",
       "default-dict": "Standard ordbokvisning"
   },
-  "article_footer": {
+  "article": {
+      "show_inflection": "Vis bøyning",
+      "hide_inflection": "Skjul bøyning",
       "share": "Del ordet",
       "copy_link": "Kopier lenke",
       "cite": "Siter",
-- 
GitLab