Skip to content

Commit

Permalink
add string replacements and the string in the about modal
Browse files Browse the repository at this point in the history
minor changes with fixes in logic to conditionally render link
  • Loading branch information
Devesh21700Kumar committed Jan 31, 2022
1 parent ae0029a commit b831689
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export default {

stringReplacements: {
'{{maintainer}}': "<a href='https://wiki.apertium.org/wiki/Apertium' target='_blank' rel='noopener'>Apertium</a>",
'{{more_languages}}': "<a href='https://beta.apertium.org' rel='noreferrer' target='_blank'>beta.apertium.org</a>"
},
} as Config;
5 changes: 5 additions & 0 deletions src/components/footer/AboutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ import gplLogo from './img/gplv3-88x31.png';
import maeLogo from './img/logo_mae_ro_75pc.jpg';
import mineturLogo from './img/logomitc120.jpg';
import prompsitLogo from './img/prompsit150x52.png';
import { useLocation } from "react-router-dom";

const AboutModal = (props: ModalProps): React.ReactElement => {
const { t } = useLocalization();
const location = useLocation();
const { pathname } = location;
const splitLocation = pathname.split("/");

return (
<Modal {...props} size="lg">
Expand All @@ -25,6 +29,7 @@ const AboutModal = (props: ModalProps): React.ReactElement => {
<Modal.Body>
<div dangerouslySetInnerHTML={{ __html: t('What_Is_Apertium') }} />
<div dangerouslySetInnerHTML={{ __html: t('Maintainer') }} style={{ paddingBottom: '2em' }} />
<div dangerouslySetInnerHTML={{ __html: t('More_Languages') }} style={{ paddingBottom: '2em', display: (splitLocation[0]==="beta.apertium.org")?"none":"" }}/>

<div className="row lead">
<Col md="6">
Expand Down
1 change: 1 addition & 0 deletions src/strings/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"Help_Improve": "Help us improve Apertium!",
"Contact_Us": "Feel free to contact us if you find a mistake, there's a project you would like to see us work on, or you would like to help out.",
"Maintainer": "This website is maintained by {{maintainer}}.",
"More_Languages": "Looking for more languages? Try {{more_languages}}",
"About_Title": "About this website",
"Enable_JS_Warning": "This site only works with JavaScript enabled, if you cannot <a href='http://www.enable-javascript.com/' target='_blank' rel='noopener'>enable Javascript</a>, then try the <a href='http://traductor.prompsit.com' target='_blank' rel='noopener'>translators at Prompsit</a>.",
"Not_Found_Error": "<b>404 Error:</b> Sorry, that page doesn't exist anymore!",
Expand Down
4 changes: 4 additions & 0 deletions src/util/__tests__/localization.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ describe('useLocalization', () => {
'Maintainer',
`<a href='https://wiki.apertium.org/wiki/Apertium' target='_blank' rel='noopener'>Apertium</a>-Default`,
],
[
'More_Languages',
`<a dangerouslySetInnerHTML={{ __html: 'beta.apertium.org' }} href='https://beta.apertium.org' rel='noreferrer' target='_blank'/>`
]
])('maps %s to %s', (id, value) => expect(t(id)).toBe(value));
});

Expand Down

0 comments on commit b831689

Please sign in to comment.