feat: common components localization

This commit is contained in:
Nick 2019-06-10 21:31:32 -04:00
parent eb66ae6088
commit 1d3a87168d
3 changed files with 20 additions and 19 deletions

View File

@ -3,18 +3,19 @@
v-card.wiki-form v-card.wiki-form
.dialog-header.is-short.is-red .dialog-header.is-short.is-red
v-icon.mr-2(color='white') highlight_off v-icon.mr-2(color='white') highlight_off
span Delete Page span {{$t('common:page.delete')}}
v-card-text v-card-text
.body-2 Are you sure you want to delete page #[span.red--text.text--darken-2 {{pageTitle}}]? i18next.body-2(path='common:page.deleteTitle', tag='div')
.caption The page can be restored from the administration area. span.red--text.text--darken-2(place='title') {{pageTitle}}
.caption {{$t('common:page.deleteSubtitle')}}
v-chip.mt-3.ml-0.mr-1(label, color='red lighten-4', disabled, small) v-chip.mt-3.ml-0.mr-1(label, color='red lighten-4', disabled, small)
.caption.red--text.text--darken-2 {{pageLocale.toUpperCase()}} .caption.red--text.text--darken-2 {{pageLocale.toUpperCase()}}
v-chip.mt-3.mx-0(label, color='red lighten-5', disabled, small) v-chip.mt-3.mx-0(label, color='red lighten-5', disabled, small)
span.red--text.text--darken-2 /{{pagePath}} span.red--text.text--darken-2 /{{pagePath}}
v-card-chin v-card-chin
v-spacer v-spacer
v-btn(flat, @click='discard', :disabled='loading') Cancel v-btn(flat, @click='discard', :disabled='loading') {{$t('common:actions.cancel')}}
v-btn(color='red darken-2', @click='deletePage', :loading='loading').white--text Delete v-btn(color='red darken-2', @click='deletePage', :loading='loading').white--text {{$t('common:actions.delete')}}
</template> </template>
<script> <script>
@ -77,7 +78,7 @@ export default {
}, 1200) }, 1200)
}, 400) }, 400)
} else { } else {
throw new Error(_.get(resp, 'data.pages.delete.responseResult.message', 'An unexpected error occured.')) throw new Error(_.get(resp, 'data.pages.delete.responseResult.message', this.$t('common:error.unexpected')))
} }
} catch (err) { } catch (err) {
this.$store.commit('pushGraphError', err) this.$store.commit('pushGraphError', err)

View File

@ -44,22 +44,22 @@ export default {
return return
} }
const strength = zxcvbn(pwd) const strength = zxcvbn(pwd)
this.passwordStrength = _.round((strength.score + 1 ) / 5 * 100) this.passwordStrength = _.round((strength.score + 1) / 5 * 100)
if (this.passwordStrength <= 20) { if (this.passwordStrength <= 20) {
this.passwordStrengthColor = 'red' this.passwordStrengthColor = 'red'
this.passwordStrengthText = 'Very Weak' this.passwordStrengthText = this.$t('common:password.veryWeak')
} else if (this.passwordStrength <= 40) { } else if (this.passwordStrength <= 40) {
this.passwordStrengthColor = 'orange' this.passwordStrengthColor = 'orange'
this.passwordStrengthText = 'Weak' this.passwordStrengthText = this.$t('common:password.weak')
} else if (this.passwordStrength <= 60) { } else if (this.passwordStrength <= 60) {
this.passwordStrengthColor = 'teal' this.passwordStrengthColor = 'teal'
this.passwordStrengthText = 'Average' this.passwordStrengthText = this.$t('common:password.average')
} else if (this.passwordStrength <= 80) { } else if (this.passwordStrength <= 80) {
this.passwordStrengthColor = 'green' this.passwordStrengthColor = 'green'
this.passwordStrengthText = 'Strong' this.passwordStrengthText = this.$t('common:password.strong')
} else { } else {
this.passwordStrengthColor = 'green' this.passwordStrengthColor = 'green'
this.passwordStrengthText = 'Very Strong' this.passwordStrengthText = this.$t('common:password.veryStrong')
} }
}, 100) }, 100)
} }

View File

@ -3,19 +3,19 @@
.search-results-container .search-results-container
.search-results-help(v-if='search.length < 2') .search-results-help(v-if='search.length < 2')
img(src='/svg/icon-search-alt.svg') img(src='/svg/icon-search-alt.svg')
.mt-4 Type at least 2 characters to start searching... .mt-4 {{$t('common:header.searchHint')}}
.search-results-loader(v-else-if='searchIsLoading && results.length < 1') .search-results-loader(v-else-if='searchIsLoading && results.length < 1')
orbit-spinner( orbit-spinner(
:animation-duration='1000' :animation-duration='1000'
:size='100' :size='100'
color='#FFF' color='#FFF'
) )
.headline.mt-5 Searching... .headline.mt-5 {{$t('common:header.searchLoading')}}
.search-results-none(v-else-if='!searchIsLoading && results.length < 1') .search-results-none(v-else-if='!searchIsLoading && results.length < 1')
img(src='/svg/icon-no-results.svg', alt='No Results') img(src='/svg/icon-no-results.svg', alt='No Results')
.subheading No pages matching your query. .subheading {{$t('common:header.searchNoResult')}}
template(v-if='results.length > 0') template(v-if='results.length > 0')
v-subheader.white--text Found {{response.totalHits}} results v-subheader.white--text {{$t('common:header.searchResultsCount', { total: response.totalHits })}}
v-list.search-results-items.radius-7(two-line) v-list.search-results-items.radius-7(two-line)
template(v-for='(item, idx) of results') template(v-for='(item, idx) of results')
v-list-tile(@click='goToPage(item)', :key='item.id', :class='idx === cursor ? `highlighted` : ``') v-list-tile(@click='goToPage(item)', :key='item.id', :class='idx === cursor ? `highlighted` : ``')
@ -35,7 +35,7 @@
:length='paginationLength' :length='paginationLength'
) )
template(v-if='suggestions.length > 0') template(v-if='suggestions.length > 0')
v-subheader.white--text.mt-3 Did you mean... v-subheader.white--text.mt-3 {{$t('common:header.searchDidYouMean')}}
v-list.search-results-suggestions.radius-7(dense, dark) v-list.search-results-suggestions.radius-7(dense, dark)
template(v-for='(term, idx) of suggestions') template(v-for='(term, idx) of suggestions')
v-list-tile(:key='term', @click='setSearchTerm(term)', :class='idx + results.length === cursor ? `highlighted` : ``') v-list-tile(:key='term', @click='setSearchTerm(term)', :class='idx + results.length === cursor ? `highlighted` : ``')
@ -47,10 +47,10 @@
.text-xs-center.pt-5(v-if='search.length > 1') .text-xs-center.pt-5(v-if='search.length > 1')
v-btn(outline, color='orange', @click='search = ``', v-if='results.length > 0') v-btn(outline, color='orange', @click='search = ``', v-if='results.length > 0')
v-icon(left) save v-icon(left) save
span Copy Search Link span {{$t('common:header.searchCopyLink')}}
v-btn(outline, color='pink', @click='search = ``') v-btn(outline, color='pink', @click='search = ``')
v-icon(left) clear v-icon(left) clear
span Close span {{$t('common:header.searchClose')}}
</template> </template>
<script> <script>