Skip to content

Add string replacements and the string in the about modal #422

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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