Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix broken translation due to missing automatic plural handling #264

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions canopeum_frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ module.exports = {
// We need to apply it directly on object literals to check for excess properties
// https://www.typescriptlang.org/docs/handbook/2/objects.html#excess-property-checks
'no-autofix/no-relative-import-paths/no-relative-import-paths': 'off',
// i18next uses snake_case for special handling
// https://www.i18next.com/translation-function/plurals#singular-plural
camelcase: 'off',
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion canopeum_frontend/src/components/CreatePostWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const CreatePostWidget = ({ siteId, addNewPost }: Props) => {
<div className='max-words end-0 text-end' style={{ bottom: '-1.6rem' }}>
<span>{postBodyNumberOfWords}/{MAXIMUM_WORDS_PER_POST}</span>
<span className='ms-1'>
{translate('social.comments.words', { count: MAXIMUM_WORDS_PER_POST })}
{translate('social.comments.word', { count: MAXIMUM_WORDS_PER_POST })}
</span>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const PostCommentsDialog = ({ open, postId, siteId, handleClose }: Props) => {
>
<span>{commentBodyNumberOfWords}/{MAXIMUM_WORDS_PER_COMMENT}</span>
<span className='ms-1'>
{translate('social.comments.words', { count: MAXIMUM_WORDS_PER_COMMENT })}
{translate('social.comments.word', { count: MAXIMUM_WORDS_PER_COMMENT })}
</span>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions canopeum_frontend/src/locale/en/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export default {
'create-site': 'Create a New Site',
'edit-site-info': 'Edit Site Information',
average: 'average',
batch_one: 'batch',
batch_other: 'batches',
sufficient: 'sufficient',
insufficient: 'insufficient',
'table-row-1': 'batch name / ID',
Expand All @@ -27,9 +29,7 @@ export default {
'success-rate-chart': {
title: 'Average Annual Success Rate Per Site',
},
batches: {
'batch-tracking': 'Batch Tracking',
},
'batch-tracking': 'Batch Tracking',
'site-summary': {
planted: 'Planted',
survived: 'Survived',
Expand Down
2 changes: 2 additions & 0 deletions canopeum_frontend/src/locale/en/social.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default {
},
comments: {
'leave-a-comment': 'Leave a Comment',
word_one: 'word',
word_other: 'words',
comments: 'Comments',
send: 'Send',
'comment-body-required': 'Your comment cannot be empty.',
Expand Down
6 changes: 3 additions & 3 deletions canopeum_frontend/src/locale/fr/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export default {
'create-site': 'Créer un Nouveau Site',
'edit-site-info': "Modifier les données d'un Site",
average: 'moyenne',
batch_one: 'lot',
batch_other: 'lots',
sufficient: 'suffisant',
insufficient: 'insuffisant',
'table-row-1': 'nom du lot / ID',
Expand All @@ -29,9 +31,7 @@ export default {
'success-rate-chart': {
title: 'Taux De Réussite Annuel Moyen Par Site',
},
batches: {
'batch-tracking': 'Suivi des Lots',
},
'batch-tracking': 'Suivi des Lots',
'site-summary': {
planted: 'Planté',
survived: 'Survécu',
Expand Down
2 changes: 2 additions & 0 deletions canopeum_frontend/src/locale/fr/social.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default {
},
comments: {
'leave-a-comment': 'Laisser un Commentaire',
word_one: 'mot',
word_other: 'mots',
comments: 'Commentaires',
send: 'Envoyer',
'comment-body-required': 'Votre commentaire ne peut pas être vide.',
Expand Down
4 changes: 2 additions & 2 deletions canopeum_frontend/src/pages/Analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const Analytics = () => {
</span>
<span className='text-capitalize'>
{site.batches.length}{' '}
{translate('analytics.batches', { count: site.batches.length })}
{translate('analytics.batch', { count: site.batches.length })}
</span>
</div>
</button>
Expand Down Expand Up @@ -223,7 +223,7 @@ const Analytics = () => {
<div className='mt-4'>
<div className='bg-cream rounded p-3 px-4'>
<div className='d-flex justify-content-between'>
<div className='fs-5'>{translate('analytics.batches.batch-tracking')}</div>
<div className='fs-5'>{translate('analytics.batch-tracking')}</div>
<div>
<span>Filters Go Here</span>
</div>
Expand Down
Loading