mirror of
https://github.com/System-End/site.git
synced 2026-04-19 19:45:07 +00:00
Move "organization" I18n into a reusable hook
This commit is contained in:
parent
0ba39e2e8b
commit
150cd44689
2 changed files with 13 additions and 5 deletions
|
|
@ -4,13 +4,10 @@ import Checkbox from './checkbox'
|
|||
import Field from './field'
|
||||
// This is using country-list instead of country-list-js as it has a smaller bundle size
|
||||
import { getNames } from 'country-list'
|
||||
import useOrganizationI18n from '../organizationI18n'
|
||||
|
||||
export default function OrganizationInfoForm({ requiredFields }) {
|
||||
const [org, setOrg] = useState('Organization')
|
||||
|
||||
useEffect(() => {
|
||||
if (navigator.language === 'en-GB') setOrg('Organisation')
|
||||
}, [])
|
||||
const org = useOrganizationI18n()
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
11
components/fiscal-sponsorship/organizationI18n.js
Normal file
11
components/fiscal-sponsorship/organizationI18n.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { useState, useEffect } from 'react'
|
||||
|
||||
export default function useOrganizationI18n() {
|
||||
const [org, setOrg] = useState('Organization')
|
||||
|
||||
useEffect(() => {
|
||||
if (navigator.language === 'en-GB') setOrg('Organisation')
|
||||
}, [])
|
||||
|
||||
return org
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue