feat: dynamic language switch for the skill picker

This commit is contained in:
Adrien Marquès 2022-10-18 15:31:55 +02:00
parent 90d13d31f5
commit 53d16159b9
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
4 changed files with 7 additions and 12 deletions

View File

@ -13,15 +13,8 @@
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import { Locales } from '@/locales'; import { Locales } from '@/locales';
// Define the props by using Vue's canonical way.
const LangPickerProps = Vue.extend({
props: {
name: String
}
})
@Component({}) @Component({})
export default class LangPicker extends LangPickerProps { export default class LangPicker extends Vue {
private locales: Locales[] = [Locales.EN, Locales.FR]; private locales: Locales[] = [Locales.EN, Locales.FR];
get current(): string { get current(): string {

View File

@ -33,12 +33,12 @@
<span :key='proj.name'>, </span> <span :key='proj.name'>, </span>
</template> </template>
</h3> </h3>
<p v-html='details.text'></p> <p v-html='details.text[$i18n.locale]'></p>
</section> </section>
</div> </div>
<input type='button' v-show='this.sel != null' value='Browse projects' @click='browse()'/> <input type='button' v-show='this.sel != null' :value="$t('skills.browse')" @click='browse()'/>
</div> </div>
<div class='spacer'></div> <div class='spacer'></div>
@ -60,7 +60,7 @@ interface Details {
icon: string|null; icon: string|null;
title: string; title: string;
projects: Project[]; projects: Project[];
text: string; text: { [key in Locales]: string };
} }
const DEFAULT_TAG = tTag.All; const DEFAULT_TAG = tTag.All;
@ -175,7 +175,7 @@ export default class SkillPicker extends Vue {
icon, icon,
title: this.$t(skillLabel(id)).toString(), title: this.$t(skillLabel(id)).toString(),
projects: projects.bySkill(id), projects: projects.bySkill(id),
text: skill.info[this.$i18n.locale as Locales], text: skill.info,
}; };
} }

View File

@ -15,6 +15,7 @@
"skills.featured-before": "Featured in", "skills.featured-before": "Featured in",
"skills.featured-after-1": "project", "skills.featured-after-1": "project",
"skills.featured-after-n": "projects", "skills.featured-after-n": "projects",
"skills.browse": "Browse projects",
"tag.all": "All", "tag.all": "All",
"tag.web": "Web", "tag.web": "Web",

View File

@ -15,6 +15,7 @@
"skills.featured-before": "Apparaît dans", "skills.featured-before": "Apparaît dans",
"skills.featured-after-1": "projet", "skills.featured-after-1": "projet",
"skills.featured-after-n": "projets", "skills.featured-after-n": "projets",
"skills.browse": "Parcourir les projets",
"tag.all": "Tout", "tag.all": "Tout",
"tag.web": "Web", "tag.web": "Web",