more i18n stuff

This commit is contained in:
Jake Potrebic 2021-01-22 17:44:41 -08:00
parent ce56f39a1f
commit 3857e85f82
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8
5 changed files with 27 additions and 8 deletions

View File

@ -41,8 +41,8 @@
</v-menu>
</template>
<template v-else>
<v-btn href="/signup" class="mr-2" color="primary" v-text="$t('nav.signup')"></v-btn>
<v-btn color="secondary" @click="$auth.login($route.fullPath)" v-text="$t('nav.login')"></v-btn>
<v-btn href="/signup" class="mr-2" color="primary">{{ $t('nav.signup') }}</v-btn>
<v-btn color="secondary" @click="$auth.login($route.fullPath)">{{ $t('nav.login') }}</v-btn>
</template>
</v-app-bar>
</template>

View File

@ -38,6 +38,20 @@ const msgs: LocaleMessageObject = {
community: 'Community',
},
},
project: {
category: {
admin_tools: 'Admin Tools',
chat: 'Chat',
dev_tools: 'Developer Tools',
economy: 'Economy',
gameplay: 'Gameplay',
games: 'Games',
protection: 'Protection',
role_playing: 'Role Playing',
world_management: 'World Management',
misc: 'Miscellaneous',
},
},
message: 'Good morning!',
};

View File

@ -28,14 +28,15 @@
<v-list dense>
<v-subheader>Categories</v-subheader>
<v-list-item-group>
<v-list-item v-for="cat in $store.state.projectCategories.values()" :key="cat.apiName">
<v-list-item v-for="cat in $store.getters.visibleCategories" :key="cat.apiName">
<v-list-item-icon>
<v-icon v-text="cat.icon" />
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title v-text="cat.title"></v-list-item-title>
</v-list-item-content> </v-list-item
></v-list-item-group>
<v-list-item-title v-text="$t(`project.category.${cat.apiName}`)"></v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list-item-group>
</v-list>
<v-list dense>

View File

@ -1,4 +1,4 @@
import { ActionTree, MutationTree } from 'vuex';
import { ActionTree, MutationTree, GetterTree } from 'vuex';
import { Context } from '@nuxt/types';
import { IProjectCategory } from 'hangar-api';
import { ProjectCategory } from '~/types/enums';
@ -31,6 +31,10 @@ export const actions: ActionTree<RootState, RootState> = {
},
};
export const getters: GetterTree<RootState, RootState> = {
visibleCategories: (state: RootState) => Array.from(state.projectCategories.values()).filter((value) => value.visible),
};
function convertToMap<E, T>(values: T[], toStringFunc: (value: T) => string): Map<E, T> {
const map = new Map<E, T>();
for (const value of values) {

View File

@ -23,7 +23,7 @@ public enum Category {
ROLE_PLAYING(7, "Role Playing", "mdi-auto-fix", "role_playing"),
WORLD_MANAGEMENT(8, "World Management", "mdi-earth", "world_management"),
MISC(9, "Miscellaneous", "mdi-asterisk", "misc"),
UNDEFINED(10, "Undefined", "", "undefined");
UNDEFINED(10, "Undefined", "", "undefined", false);
private final int value;
private final String title;