Skip to content

Commit

Permalink
refactor(l10n): allow translation of filtering options (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Mar 6, 2024
1 parent 4ea4387 commit c013a76
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export default {
PRODUCT_QUANTITY_UNIT_ML: 'ml',
FILTER_PARAM: 'filter',
PRODUCT_FILTER_LIST: [
{ key: 'hide_price_count_gte_1', value: 'Hide products with prices' },
{ key: 'hide_price_count_gte_1', value: 'FilterProductWithPriceCountHide' },
],
PRICE_FILTER_LIST: [
{ key: 'only_last_30d', value: 'Only prices for the last 30 days' },
{ key: 'only_last_30d', value: 'FilterPriceMoreThan30DaysHide' },
],
ORDER_BY_PARAM: 'order_by',
PRODUCT_ORDER_BY_LIST: [
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"Common": {
"AddToOFF": "Add to {name}",
"Filter": "Filter",
"FilterProductWithPriceCountHide": "Hide products with prices",
"FilterPriceMoreThan30DaysHide": "Hide prices older than 30 days",
"Order": "Order",
"OrderProductUniqueScansDESC": "Number of scans",
"OrderProductPriceCountDESC": "Number of prices",
Expand Down
2 changes: 1 addition & 1 deletion src/views/BrandDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</template>
<v-list>
<v-list-item :slim="true" v-for="filter in productFilterList" :key="filter.key" :prepend-icon="(productFilter === filter.key) ? 'mdi-check-circle' : 'mdi-circle-outline'" :active="productFilter === filter.key" @click="toggleProductFilter(filter.key)">
{{ filter.value }}
{{ $t('Common.' + filter.value) }}
</v-list-item>
</v-list>
</v-menu>
Expand Down
2 changes: 1 addition & 1 deletion src/views/CategoryDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</template>
<v-list>
<v-list-item :slim="true" v-for="filter in productFilterList" :key="filter.key" :prepend-icon="(productFilter === filter.key) ? 'mdi-check-circle' : 'mdi-circle-outline'" :active="productFilter === filter.key" @click="toggleProductFilter(filter.key)">
{{ filter.value }}
{{ $t('Common.' + filter.value) }}
</v-list-item>
</v-list>
</v-menu>
Expand Down
2 changes: 1 addition & 1 deletion src/views/LocationDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</template>
<v-list>
<v-list-item :slim="true" v-for="filter in priceFilterList" :key="filter.key" :prepend-icon="(priceFilter === filter.key) ? 'mdi-check-circle' : 'mdi-circle-outline'" :active="priceFilter === filter.key" @click="togglePriceFilter(filter.key)">
{{ filter.value }}
{{ $t('Common.' + filter.value) }}
</v-list-item>
</v-list>
</v-menu>
Expand Down
2 changes: 1 addition & 1 deletion src/views/ProductDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</template>
<v-list>
<v-list-item :slim="true" v-for="filter in priceFilterList" :key="filter.key" :prepend-icon="(priceFilter === filter.key) ? 'mdi-check-circle' : 'mdi-circle-outline'" :active="priceFilter === filter.key" @click="togglePriceFilter(filter.key)">
{{ filter.value }}
{{ $t('Common.' + filter.value) }}
</v-list-item>
</v-list>
</v-menu>
Expand Down
2 changes: 1 addition & 1 deletion src/views/ProductList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</template>
<v-list>
<v-list-item :slim="true" v-for="filter in productFilterList" :key="filter.key" :prepend-icon="(productFilter === filter.key) ? 'mdi-check-circle' : 'mdi-circle-outline'" :active="productFilter === filter.key" @click="toggleProductFilter(filter.key)">
{{ filter.value }}
{{ $t('Common.' + filter.value) }}
</v-list-item>
</v-list>
</v-menu>
Expand Down
2 changes: 1 addition & 1 deletion src/views/UserDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</template>
<v-list>
<v-list-item :slim="true" v-for="filter in priceFilterList" :key="filter.key" :prepend-icon="(priceFilter === filter.key) ? 'mdi-check-circle' : 'mdi-circle-outline'" :active="priceFilter === filter.key" @click="togglePriceFilter(filter.key)">
{{ filter.value }}
{{ $t('Common.' + filter.value) }}
</v-list-item>
</v-list>
</v-menu>
Expand Down

0 comments on commit c013a76

Please sign in to comment.