Skip to content

Commit

Permalink
feat(i18n): stub locales for public-form
Browse files Browse the repository at this point in the history
Identify common error messages that a member of the public might see
in a form page, and place them in a locale specifically for that.

TODO - Move some of the validation messages in common over to this
  • Loading branch information
LoneRifle committed Apr 25, 2024
1 parent 3c8db4f commit 073dab0
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/en-sg.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { enSG as common } from './features/common'
import { enSG as login } from './features/login'
import { enSG as publicForm } from './features/public-form'
import Translation from './types'

export const enSG: Translation = {
translation: {
features: {
common,
login,
publicForm,
},
},
}
1 change: 1 addition & 0 deletions frontend/src/i18n/locales/features/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { type Common } from './common'
export { type Login } from './login'
export { type PublicForm } from './public-form'
27 changes: 27 additions & 0 deletions frontend/src/i18n/locales/features/public-form/en-sg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { PublicForm } from '.'

export const enSG: PublicForm = {
errors: {
notAvailable: 'This form is not available.',
notFound: 'Form not found',
deleted: 'This form is no longer active',
private:
'If you think this is a mistake, please contact the agency that gave you the form link.',

submissionSecretKeyInvalid: {
title: 'Invalid form link',
header: 'This form link is no longer valid.',
message:
'A submission may have already been made using this link. If you think this is a mistake, please contact the agency that gave you the form link.',
},

myinfo:
'Your Myinfo details could not be retrieved. Refresh your browser and log in, or try again later.',
submitFailure:
'An error occurred whilst processing your submission. Please refresh and try again.',
verifiedFieldExpired_one:
'Your verified field {{count}} has expired. Please verify the {{count}} field again.',
verifiedFieldExpired_other:
'Your verified fields {{count}} have expired. Please verify those {{count}} fields again.',
},
}
21 changes: 21 additions & 0 deletions frontend/src/i18n/locales/features/public-form/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export * from './en-sg'
export * from './zh-sg'

export interface PublicForm {
errors: {
notAvailable: string
notFound: string
deleted: string
private: string

submissionSecretKeyInvalid: {
title: string
header: string
message: string
}
myinfo: string
submitFailure: string
verifiedFieldExpired_one: string
verifiedFieldExpired_other: string
}
}
27 changes: 27 additions & 0 deletions frontend/src/i18n/locales/features/public-form/zh-sg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { PublicForm } from '.'

export const zhSG: PublicForm = {
errors: {
notAvailable: 'This form is not available.',
notFound: 'Form not found',
deleted: 'This form is no longer active',
private:
'If you think this is a mistake, please contact the agency that gave you the form link.',

submissionSecretKeyInvalid: {
title: 'Invalid form link',
header: 'This form link is no longer valid.',
message:
'A submission may have already been made using this link. If you think this is a mistake, please contact the agency that gave you the form link.',
},

myinfo:
'Your Myinfo details could not be retrieved. Refresh your browser and log in, or try again later.',
submitFailure:
'An error occurred whilst processing your submission. Please refresh and try again.',
verifiedFieldExpired_one:
'Your verified field {{count}} has expired. Please verify the {{count}} field again.',
verifiedFieldExpired_other:
'Your verified fields {{count}} have expired. Please verify those {{count}} fields again.',
},
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/locales/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Common, Login } from './features'
import { Common, Login, PublicForm } from './features'

interface Translation {
translation: {
features: {
common: Common
publicForm: PublicForm
login: Login
}
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/i18n/locales/zh-sg.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { zhSG as common } from './features/common'
import { zhSG as login } from './features/login'
import { zhSG as publicForm } from './features/public-form'
import Translation from './types'

export const zhSG: Translation = {
translation: {
features: {
common,
login,
publicForm,
},
},
}

0 comments on commit 073dab0

Please sign in to comment.