Skip to content

Commit

Permalink
fix(models/document): Rename "stranger" locale
Browse files Browse the repository at this point in the history
This term had been replaced in the MyPapers app
but was forgotten here.
As a result, we've lost the ''(Foreign)'' display on papers
such as the foreign driver's license, and this generates
a lot of error logs.
  • Loading branch information
Merkur39 committed May 17, 2024
1 parent 5480107 commit 38a0f68
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/cozy-client/src/models/document/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"country": {
"stranger": "Stranger"
"foreign": "Foreign"
},
"Scan": {
"scan_a_doc": "Scan a doc",
Expand Down
2 changes: 1 addition & 1 deletion packages/cozy-client/src/models/document/locales/fr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"country": {
"stranger": "Étranger"
"foreign": "Étranger"
},
"Scan": {
"scan_a_doc": "Numériser un doc",
Expand Down
4 changes: 2 additions & 2 deletions packages/cozy-client/src/models/document/locales/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const getBoundT = lang => {
const country = opts?.country

const emojiCountry =
country !== 'stranger' ? getEmojiByCountry(country) : null
const strangerLabel = country === 'stranger' ? t('country.stranger') : null
country !== 'foreign' ? getEmojiByCountry(country) : null
const strangerLabel = country === 'foreign' ? t('country.foreign') : null

return emojiCountry || strangerLabel
? `${t(label, newOpts)} ${emojiCountry || strangerLabel}`
Expand Down
20 changes: 10 additions & 10 deletions packages/cozy-client/src/models/document/locales/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ describe('getBoundT', () => {
})

it.each`
translationKey | country | smart_count | lang | expected
${'Scan.items.national_id_card'} | ${undefined} | ${undefined} | ${'en'} | ${'ID card'}
${'Scan.items.national_id_card'} | ${'fr'} | ${undefined} | ${'en'} | ${'ID card 🇫🇷'}
${'Scan.items.national_id_card'} | ${'stranger'} | ${undefined} | ${'en'} | ${'ID card Stranger'}
${'Scan.items.national_id_card'} | ${'be'} | ${1} | ${'en'} | ${'ID card 🇧🇪'}
${'Scan.items.national_id_card'} | ${'be'} | ${2} | ${'en'} | ${'ID cards 🇧🇪'}
${'Scan.items.national_id_card'} | ${'fr'} | ${1} | ${'en'} | ${'ID card 🇫🇷'}
${'Scan.items.national_id_card'} | ${'fr'} | ${2} | ${'en'} | ${'ID cards 🇫🇷'}
${'Scan.items.national_id_card'} | ${undefined} | ${1} | ${'en'} | ${'ID card'}
${'Scan.items.national_id_card'} | ${undefined} | ${2} | ${'en'} | ${'ID cards'}
translationKey | country | smart_count | lang | expected
${'Scan.items.national_id_card'} | ${undefined} | ${undefined} | ${'en'} | ${'ID card'}
${'Scan.items.national_id_card'} | ${'fr'} | ${undefined} | ${'en'} | ${'ID card 🇫🇷'}
${'Scan.items.national_id_card'} | ${'foreign'} | ${undefined} | ${'en'} | ${'ID card Foreign'}
${'Scan.items.national_id_card'} | ${'be'} | ${1} | ${'en'} | ${'ID card 🇧🇪'}
${'Scan.items.national_id_card'} | ${'be'} | ${2} | ${'en'} | ${'ID cards 🇧🇪'}
${'Scan.items.national_id_card'} | ${'fr'} | ${1} | ${'en'} | ${'ID card 🇫🇷'}
${'Scan.items.national_id_card'} | ${'fr'} | ${2} | ${'en'} | ${'ID cards 🇫🇷'}
${'Scan.items.national_id_card'} | ${undefined} | ${1} | ${'en'} | ${'ID card'}
${'Scan.items.national_id_card'} | ${undefined} | ${2} | ${'en'} | ${'ID cards'}
`(
'should test if the translation is suitable with the param country: $country and with the param smart_count: $smart_count',
({ translationKey, country, smart_count, lang, expected }) => {
Expand Down

0 comments on commit 38a0f68

Please sign in to comment.