LANGUAGE
TMG and Gedsite provide for genealogy data to be in different languages (in our case, English and Portuguese), catering for some words and phrases like Parents, Birth, Marriage, Son. For other text, translation needs to be manual (typically using Google Translate).
Our websites display either English or Portuguese text on almost every page. Both language versions are stored together in the same page, but only one is shown at a time.
Distinguishing Languages
Each piece of text is enclosed ("wrapped") in HTML tags that identify its language:
- The class="eng" marks the English text.
- The class="port" marks the Portuguese text.
- Instead of <span>.</span>, you can also use other wrappers like <p>...</p> or <div>...</div>.
Click to see the coding for language switching for the English site.
For long pages – simplify markup
On long pages with large sections of text in each language, you don't need to wrap every paragraph individually. For convenience, you can group all English content in a <div class="eng">...</div> container, applying the language class just once, and use a similar <div class="port">...</div> for all the Portuguese content.
In Elementor or the WordPress block editor, you can achieve this by:
- Dragging all English blocks into a single container and setting its class to eng.
- Dragging all Portuguese blocks into another container with class port.
- For very complex pages (many mixed sections or nested containers), you may find it quicker to get an AI assistant like ChatGPT to merge the structure automatically into two master blocks.
CSS Coding
I have not succeeded in finding a link for the MenuBar that will switch between languages both for the local (desktop) version and for the website, and have had to accept that clicking on language switch on the MenuBar of the desktop version will take you to the website (instead of remaining in the desktop). (This is an irritation during development but of course does not affect the operation of the website.)
See the link from the Portuguese to the English site.
Parallel English-Portuguese Site Design
-
Check that the correct language has been set in TMG:
- In TMG>File>Language select Portugues.
- If asked whether to proceed, click Yes.
- Close TMG.
- Open the file En.gsfile and save it as Pt.gsfile (normally in folder C:\UDF2\Gedsite).
- Update Data > Database.
- Click Language and set Site Language, Sort Language and Sentence Language to Portuguese (Portugal).
- In Styles>User Styles>LANGUAGE SWITCH
- change Selector-1 from port to eng
- change Selector-2 from eng to port
- Set Publish>SubFolder to macfams/priv/GS/port.
- Make the site: File>Make Site or click Ctrl-M.
- Check that all is well.
- Upload to the website: Family History Hosting > Publish.
- Check: Log in to the website and click on Portuguese and then English.
Administrator tasks
- Editing content: wherever possible, include both English and Portuguese versions on every page, properly wrapped in eng and port.
- For long sections: wrap all paragraphs of the same language in one block rather than many small spans.
- Testing: after saving, click both English and Portuguese menu items to ensure switching works.
- Do not make any alterations to the CSS or JavaScript unless you are comfortable with code — these control how switching works.