Skip to content

Commit

Permalink
refactor(l10n): add new pluralization translations. Start cleaning un…
Browse files Browse the repository at this point in the history
…used translations (#1079)
  • Loading branch information
raphodn authored Dec 3, 2024
1 parent b04389a commit 04c384b
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 52 deletions.
9 changes: 8 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import vueI18n from '@intlify/eslint-plugin-vue-i18n'

export default [
js.configs.recommended,
...pluginVue.configs['flat/recommended'],
...vueI18n.configs['flat/recommended'],
{
ignores: ['dist/**', '*.config.js', 'tests/**'],
},
Expand All @@ -16,6 +18,11 @@ export default [
'vue/max-attributes-per-line': 'off',
'vue/attribute-hyphenation': 'off',
'vue/v-on-event-hyphenation': 'off',
}
},
settings: {
'vue-i18n': {
localeDir: './i18n/locales/*.json'
}
},
},
]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"vuetify": "^3.7.3"
},
"devDependencies": {
"@intlify/eslint-plugin-vue-i18n": "^3.1.0",
"@mdi/font": "^7.4.47",
"@vitejs/plugin-vue": "^5.1.4",
"@vue/compiler-sfc": "^3.5.12",
Expand Down
4 changes: 3 additions & 1 deletion src/components/BarcodeScannerDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div>
<i18n-t keypath="BarcodeScanner.Htlm5-qrcode.Text" tag="span">
<template #url>
<a href="https://github.com/mebjas/html5-qrcode" target="_blank">html5-qrcode</a>
<a :href="HTML5_QRCODE_URL" target="_blank">{{ HTML5_QRCODE_NAME }}</a>
</template>
</i18n-t>
</div>
Expand All @@ -43,6 +43,8 @@ export default {
data() {
return {
scanner: null,
HTML5_QRCODE_URL: 'https://github.com/mebjas/html5-qrcode',
HTML5_QRCODE_NAME: 'html5-qrcode'
}
},
mounted() {
Expand Down
44 changes: 13 additions & 31 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,6 @@
"Submit": "Submit",
"Title": "Type a barcode"
},
"BrandDetail": {
"LoadMore": "Load more",
"TopProducts": "Top products",
"BrandProductTotal": "{count} products"
},
"CategoryDetail": {
"LoadMore": "Load more",
"TopProducts": "Top products",
"CategoryProductTotal": "{count} products"
},
"Common": {
"About": "About",
"AddPrice": "Add a price",
Expand All @@ -155,6 +145,8 @@
"BarcodeType": "Type a barcode",
"BarcodeInvalid": "Invalid barcode",
"Brand": "Brand",
"Brands": "Brands",
"BrandTotal": "{count} brands | {count} brand | {count} brands",
"Price": "Price",
"Prices": "Prices",
"Product": "Product",
Expand All @@ -163,6 +155,7 @@
"Proofs": "Proofs",
"Category": "Category",
"Categories": "Categories",
"CategoryTotal": "{count} categories | {count} category | {count} categories",
"Chart": "Chart",
"Contributors": "Contributors",
"Community": "Community",
Expand All @@ -180,6 +173,7 @@
"Experiments": "Experiments",
"Label": "Label",
"Labels": "Labels",
"LabelTotal": "{count} labels | {count} label | {count} labels",
"Language": "Languages",
"Languages": "Languages",
"LatestPrices": "Latest prices",
Expand Down Expand Up @@ -218,7 +212,7 @@
"ImageFull": "Full-size image",
"Latest": "Latest",
"LinkCopySuccess": "Link copied",
"LocationCount": "{count} locations",
"LocationCount": "{count} locations | {count} location | {count} locations",
"Map": "Map",
"Offline": "Offline",
"Online": "Online",
Expand All @@ -237,11 +231,14 @@
"OrderUserCountDESC": "User count",
"PersonalInfo": "Personal information",
"Physical": "Physical",
"PriceCount": "{count} prices",
"PriceCount": "{count} prices | {count} price | {count} prices",
"PriceCreated": "Price created!",
"PricesMore": "More prices",
"ProductCount": "{count} products",
"ProofCount": "{count} proofs",
"Private": "Private",
"Privacy": "Privacy",
"ProductCount": "{count} products | {count} product | {count} products",
"ProofCount": "{count} proofs | {count} proof | {count} proofs",
"Public": "Public",
"Receipt": "Receipt",
"Receipts": "Receipts",
"ReceiptPriceCount": "Number of prices",
Expand Down Expand Up @@ -281,7 +278,8 @@
"URLInvalid": "Invalid URL",
"User": "User",
"Users": "Users",
"UserCount": "{count} users",
"UserCount": "{count} users | {count} user | {count} users",
"UserContributorCount": "{count} contributors | {count} contributor | {count} contributors",
"View": "View",
"Website": "Website",
"Yes": "Yes",
Expand Down Expand Up @@ -337,11 +335,6 @@
"LoadMore": "Load more",
"LocationNotFound": "Location not found in OpenStreetMap... Don't hesitate to add it :)"
},
"LocationList": {
"Title": "Top locations",
"LoadMore": "Load more",
"LocationTotal": "{count} locations"
},
"LocationSelector": {
"Clear": "Clear",
"NoResult": "No results found",
Expand All @@ -368,9 +361,6 @@
"FullPrice": "Full price",
"UnknownProduct": "Unknown product"
},
"PriceCountChip": {
"PriceCount": "{count} prices"
},
"PriceDelete": {
"Confirmation": "Are you sure you want to delete this price?",
"Delete": "Delete",
Expand Down Expand Up @@ -430,14 +420,6 @@
"LoadMore": "Load more",
"ProductNotFound": "Product not found in Open Food Facts... Don't hesitate to add it :)"
},
"ProductList": {
"HideProductsWithPrices": "Hide products with prices",
"LoadMore": "Load more",
"PriceNumber": "Number of prices added",
"ScanNumber": "Number of scans added",
"Title": "Top products",
"ProductTotal": "{count} products"
},
"ProofCard": {
"Proof": "Proof",
"PRICE_TAG": "Price tag",
Expand Down
2 changes: 1 addition & 1 deletion src/views/LocationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-row v-if="!loading">
<v-col>
<v-chip label variant="text" prepend-icon="mdi-map-marker-outline">
{{ $t('LocationList.LocationTotal', { count: locationTotal }) }}
{{ $t('Common.LocationCount', { count: locationTotal }) }}
</v-chip>
<FilterMenu kind="location" :currentFilter="currentFilter" :currentType="currentType" @update:currentFilter="toggleLocationFilter($event)" @update:currentType="toggleLocationType($event)" />
<OrderMenu kind="location" :currentOrder="currentOrder" @update:currentOrder="selectLocationOrder($event)" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/ProductList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-row v-if="!loading">
<v-col>
<v-chip label variant="text" prepend-icon="mdi-database-outline">
{{ $t('ProductList.ProductTotal', { count: productTotal }) }}
{{ $t('Common.ProductCount', { count: productTotal }) }}
</v-chip>
<FilterMenu kind="product" :currentFilter="currentFilter" :currentSource="currentSource" @update:currentFilter="toggleProductFilter($event)" @update:currentSource="toggleProductSource($event)" />
<OrderMenu kind="product" :currentOrder="currentOrder" @update:currentOrder="selectProductOrder($event)" />
Expand Down
2 changes: 1 addition & 1 deletion src/views/UserDashboardPriceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-row v-if="!loading">
<v-col>
<v-chip label variant="text" prepend-icon="mdi-tag-multiple-outline">
{{ $t('UserDashboard.UserPriceTotal', { count: userPriceTotal }) }}
{{ $t('Common.PriceCount', { count: userPriceTotal }) }}
</v-chip>
<LoadedCountChip :loadedCount="userPriceList.length" :totalCount="userPriceTotal" />
</v-col>
Expand Down
2 changes: 1 addition & 1 deletion src/views/UserDashboardProofList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-row v-if="!loading">
<v-col>
<v-chip label variant="text" prepend-icon="mdi-image">
{{ $t('UserDashboard.UserProofTotal', { count: userProofTotal }) }}
{{ $t('Common.ProofCount', { count: userProofTotal }) }}
</v-chip>
<LoadedCountChip :loadedCount="userProofList.length" :totalCount="userProofTotal" />
<FilterMenu v-if="userProofList.length" kind="proof" :currentFilter="currentFilter" :currentType="currentType" @update:currentFilter="toggleProofFilter($event)" @update:currentType="toggleProofType($event)" />
Expand Down
Loading

0 comments on commit 04c384b

Please sign in to comment.