Skip to content

Commit

Permalink
Validate consistent shape of translation files (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel-Therrien-Beslogic authored Oct 3, 2024
1 parent a6884b4 commit cbd3b82
Show file tree
Hide file tree
Showing 44 changed files with 616 additions and 577 deletions.
13 changes: 13 additions & 0 deletions canopeum_frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,17 @@ module.exports = {
// https://github.com/cartant/eslint-plugin-etc/issues/63
'etc/no-implicit-any-catch': 'off',
},
overrides: [
{
files: 'src/locale/**/*.ts',
rules: {
// We prefer avoiding line-breaks in translation files
'max-len': 'off',
// Imports across languages to use the "satisfies" keyword on object literals
// 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',
},
},
],
}
67 changes: 0 additions & 67 deletions canopeum_frontend/src/locale/en/analytics.json

This file was deleted.

65 changes: 65 additions & 0 deletions canopeum_frontend/src/locale/en/analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
export default {
title: 'Manage my Sites',
'create-site': 'Create a New Site',
'edit-site-info': 'Edit Site Information',
average: 'average',
sufficient: 'sufficient',
insufficient: 'insufficient',
'table-row-1': 'batch name / ID',
'table-row-2': 'sponsor',
'table-row-3': 'species',
'table-row-4': 'size of land planted',
'table-row-5': 'soil condition',
'table-row-6': 'fertilizers',
'table-row-7': 'mulch layers',
'table-row-8': 'supported species',
'table-row-9': 'number of plants',
'table-row-10': 'how many survived',
'table-row-11': 'how many replaced',
'table-row-12': 'amount of seeds collected in area',
'table-row-13': 'types of seeds collected',
'last-update': 'Last Update',
visitors: 'Visitors',
sponsored: 'Sponsored',
'unnamed-site': 'Unnamed site',
'site-save-success': 'Site saved successfully',
'site-save-error': 'Error saving Site',
'success-rate-chart': {
title: 'Average Annual Success Rate Per Site',
},
batches: {
'batch-tracking': 'Batch Tracking',
},
'site-summary': {
planted: 'Planted',
survived: 'Survived',
propagation: 'Propagation',
sponsored: 'Sponsored',
'no-admins': 'No Admins',
visitors: 'Visitors',
unknown: 'Unknown',
'admins-saved': 'Admins saved successfully for {{siteName}}!',
'delete-site-confirmation-title': 'Delete Site',
'delete-site-confirmation-message': 'Are you sure you want to delete the site {{siteName}}?',
'site-deleted': 'Site {{siteName}} was successfully deleted.',
'site-deleted-error': 'There was a problem while trying to delete the site {{siteName}}...',
},
'site-modal': {
'site-name': 'site name',
'site-type': 'site type',
'site-image': 'project image or enterprise logo',
'site-gps-coordinates': 'GPS coordinates',
'site-dms-latitude': 'DMS latitude',
'site-dms-longitude': 'DMS longitude',
'site-presentation': 'brief presentation',
'site-size': 'size of the land',
'site-tree-species': 'Number of Trees per Species',
'site-research-partner': 'research partnership?',
'site-map-visibility': 'visibility on the map',
yes: 'yes',
no: 'no',
visible: 'visible',
invisible: 'invisible',
},
'image-upload': 'or drop an image to upload',
}
46 changes: 0 additions & 46 deletions canopeum_frontend/src/locale/en/analyticsSite.json

This file was deleted.

46 changes: 46 additions & 0 deletions canopeum_frontend/src/locale/en/analyticsSite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export default {
location: 'Location',
'batch-tracking': 'Batch Tracking',
'site-tabs': {
analytics: 'Analytics',
social: 'Social',
},
'social-page': 'Social Page',
sponsors: 'Sponsors',
'add-new-batch': 'Add a New Batch',
'edit-batch': 'Edit Batch',
'delete-batch': {
title: 'Delete Batch',
message: 'Are you sure you want to delete {{batchName}} batch?',
success: 'Batch {{batchName}} was successfully deleted.',
error: 'There was a problem while trying to delete the batch {{batchName}}...',
},
'batch-modal': {
'create-title': 'Create a New Batch',
'edit-title': 'Edit a Batch',
'name-label': 'Batch Name / ID',
'sponsor-name-label': 'Sponsor',
'sponsor-website-url-label': 'Sponsor website URL',
'sponsor-logo-label': 'Sponsor logo',
'size-label': 'Size of the land',
'feet-squared': 'ft²',
'number-of-trees-label': 'Number of Trees per Species',
'soil-condition-label': 'Soil condition',
'fertilizers-label': 'Fertilizers',
'mulch-layers-label': 'Mulch layers',
'support-species-label': 'Support Species',
'total-number-of-plants-label': 'Total Number of plants',
'survived-label': 'How many survived',
'replaced-label': 'How many replaced',
'seeds-per-species-label': 'Number of Seeds Collected per Species',
'total-seeds-label': 'Total number of seeds collected',
'propagation-label': 'Total Propagation',
'images-label': 'Image',
feedback: {
'create-success': 'Batch created successfully',
'create-error': 'Error creating batch',
'edit-success': 'Batch edited successfully',
'edit-error': 'Error editing batch',
},
},
}
25 changes: 0 additions & 25 deletions canopeum_frontend/src/locale/en/auth.json

This file was deleted.

28 changes: 28 additions & 0 deletions canopeum_frontend/src/locale/en/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export default {
'log-in-header-text': 'Log In to Your Account',
'sign-up-header-text': 'Create Your Account',
'username-label': 'Username',
'username-error-required': 'Please enter a username',
'email-label': 'Email Address',
'email-error-required': 'Please enter an email address',
'email-error-format': 'Please enter a valid email address',
'password-label': 'Password',
'password-error-required': 'Please enter a password',
'password-error-format':
'Password is invalid. It must contain minimum 8 characters, and at least 1 letter and 1 number.',
'create-password-label': 'Create Password',
'password-confirmation-label': 'Re-enter Password',
'password-confirmation-error-required': 'Please re-enter your password',
'password-error-must-match': 'Passwords do not match',
'log-in': 'Log In',
'sign-up': 'Sign Up',
'create-account': 'Create Account',
'already-have-an-account': 'Already have an account?',
'back-to-map': 'Back to the map',
'log-in-error': 'Error while trying to log in',
'sign-up-error': 'Error while trying to sign up',
'code-invalid':
'Your invitation link is invalid. Please contact the person who invited you to ask for a new link.',
'invitation-expired':
'Your invitation is expired. Please contact the person who invited you to ask for a new link.',
}
8 changes: 0 additions & 8 deletions canopeum_frontend/src/locale/en/errors.json

This file was deleted.

8 changes: 8 additions & 0 deletions canopeum_frontend/src/locale/en/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
'email-taken': 'There is already a user using this email.',
'current-password-invalid': 'The entered current password is invalid.',
'password-error-must-match': 'Passwords do not match',
'email-invalid': 'Invalid email format (e.g. [email protected])',
'url-invalid': 'Invalid URL format (e.g. https://www.contoso.com)',
'phone-invalid': 'Invalid phone number format (e.g. +1 123 456 7890)',
}
11 changes: 0 additions & 11 deletions canopeum_frontend/src/locale/en/generic.json

This file was deleted.

11 changes: 11 additions & 0 deletions canopeum_frontend/src/locale/en/generic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default {
cancel: 'Cancel',
delete: 'Delete',
ok: 'Ok',
submit: 'Submit',
subscribe: 'Subscribe',
'copied-clipboard': 'Copied to clipboard',
'error-default': 'Oooops! There was a problem while loading the data.',
upload: 'Upload',
edit: 'Edit',
}
5 changes: 0 additions & 5 deletions canopeum_frontend/src/locale/en/home.json

This file was deleted.

6 changes: 6 additions & 0 deletions canopeum_frontend/src/locale/en/home.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
title: 'Hello {{username}},',
subtitle: "Here's the latest news of all organizations you followed:",
'no-news':
"You have no followed content. Please visit a site's social page to follow it and subscribe to its news.",
}
Loading

0 comments on commit cbd3b82

Please sign in to comment.