Static web pages
If there are pages with a lot of static content then these need to be translated.
To assist this we do not write large blocks of content into the source code javascript files. Instead do one of the following:
Source code Markdown file
Create a markdown file in either the folder for the page/component, or in a common resources folder.
Load the md file into the page using import - this will return a string containing the text in the file (using webpack raw-loader).
Pass the md as the body of a <Markdown> tag.
import Markdown from 'markdown-to-jsx'; import markdown from './markdown-example.md'; <Markdown>{markdown}</Markdown>
Markdown from database
Similar to above but obtain the markdown text from a database or api call and place into the Markdown component.
Internationalisation
I have not done this yet but I would like to translate markdown files as follows
first create a copy of the file named for each language supported.
e.g calltoaction.md → calltoaction.en.md, calltoaction.mi.md