VIVO Documentation
...
Table of Contents | ||
---|---|---|
|
Excerpt |
---|
When a VIVO site supports a language other than English, that support includes:
Languages can be selected in a variety of ways, depending on the installation parameters:
|
...
VIVO language files are available for English (U.S. and Canadian), Spanish, Brazilian Portuguese, French (Canadian) and German. If you need support for another language, please inquire of the VIVO mailing lists, to see if another group has the files you need. |
In this step by step guide we will use the German language files as an example. After you installed VIVO (as described here), clone your desired VIVO-language
and Vitro-language
folders/repositories (in this example we will use the files from https://github.com/vivo-DE). Be Be sure to use the theme 'wilma' or 'tenderfoot' for this to work without issues.
VIVO-language
and Vitro-language) and install them with Maven using mvn install
vivo_home_dir/config/runtime.properties
file in your VIVO home directory:RDFService.languageFilter = true
languages.selectableLocales = en_US, de_DE
For more details, see Enabling Interface Languages in VIVO as an Administrator.
<version>
in the pom.xml
files for VIVO and Vitro-languages matches the <version>
of VIVO you are building againstGo into the VIVO project folder and uncomment the section for multiple language support (search for '<!-- Dependencies for multilingual support -->'
and
'<!-- Overlays for multilingual support -->
' inside of the files) in each of the pom.xml
files listed below:
VIVO/installer/home/pom.xml (Uncomment dependencies)
VIVO/installer/webapp/pom.xml(Uncomment dependencies and overlays)
<version>
in the two pom.xml
files to the same version as in the 'VIVO-language/pom.xml
' and 'Vitro-language/pom.xml
' file respectively. You may need to change the version in multiple places in the files.VIVO-language
and Vitro-language) and install them with Maven using mvn install
mvn install -o -s installer/my-settings.xml
(Note the -o flag, this forces Maven to use the language projects from your local repository instead of downloading from a remote repository)
Build VIVO from the VIVO project folder using mvn install -s installer/my-settings.xml
vivo_home_dir/config/runtime.properties
file in your VIVO home directory:RDFService.languageFilter = true
languages.selectableLocales = en_US, de_DE
...
Your locale is an internationally recognized code that specifies the language you choose, and the region where it is spoken. For example, the locale string fr_CA
is used for French as spoken in Canada, and es_MX
is used for Spanish as spoken in Mexico. Recognized codes for languages and regions can be found by a simple Google search. Here is a list of locales that are recognized by the Java programming language. You may also use this definitive list of languages and regions, maintained by the Internet Assigned Numbers Authority.
...
You can get the US English (en_US) files from the VIVO-language and Vitro-language among the vivo-project repositories (https://github.com/vivo-project), to use as a template for your own files.
The process simply consist consists of duplicating each file having the extension en_US inside VIVO/Vitro -language repositories and renaming the copy using the locale of the new language. The new file files will reside along side ( in the same a directory ) the original one. named after the new locale.
For example, when initializing the languages files for Estonian (et_EE)
, copying the file vivo_all_en_US.properties will help creating vivo_all_et_EE.properties. Both of them The new file will reside in vivo-languages/et_EE/webapp/src/main/webapp/i18n
...
...
They are located in:
...
Code Block | ||
---|---|---|
| ||
Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/search-help_et_EE.ftl Vitro-languageslanguages/et_EE/webapp/src/main/webapp/templates/freemarker/termsOfUse_et_EE.ftl Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/userAccounts-acctCreatedEmail_et_EE.ftl Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/userAccounts-acctCreatedExternalOnlyEmail_et_EE.ftl Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/userAccounts-confirmEmailChangedEmail_et_EE.ftl Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/userAccounts-firstTimeExternalEmail_et_EE.ftl Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/userAccounts-passwordCreatedEmail_et_EE.ftl Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/userAccounts-passwordResetCompleteEmail_et_EE.ftl Vitro-languages/et_EE/webapp/src/main/webapp/templates/freemarker/userAccounts-passwordResetPendingEmail_et_EE.ftl VIVO-languages/et_EE/webapp/src/main/webapp/templates/freemarker/body/aboutMapOfScience_et_EE.ftl VIVO-languages/et_EE/webapp/src/main/webapp/templates/freemarker/body/aboutQrCodes_et_EE.ftl VIVO-languages/et_EE/webapp/src/main/webapp/templates/freemarker/visualization/mapOfScience/mapOfScienceTooltips_et_EE.ftl |
...
Data in the RDF models includes include labels for the properties and classes, labels for property groups and class groups, labels for menu pages and more. Here is the list of directories where one will have to create required rdf files:
...
one will have to create required rdf files:
In each case, the delivered file in English has a corresponding file with the same name followed by and underscore and the name of the locale. See illustrations below:
In each case, the delivered file in English has a corresponding file with the same name followed by and underscore and the name of the locale. See illustrations below:
Code Block | ||
---|---|---|
| ||
Code Block | ||
| ||
[VIVO]/languages/et_EE/rdf/applicationMetadata/firsttime/classgroups_labels_et_EE.n3 [VIVO]/languages/et_EE/rdf/applicationMetadata/firsttime/propertygroups_labels_et_EE.n3 [VIVO]/languages/et_EE/rdf/display/everytime/PropertyConfig_et_EE.n3 [VIVO]/languages/et_EE/rdf/display/firsttime/aboutPage_et_EE.n3 [VIVO]/languages/et_EE/rdf/displayi18n/firsttime/menu_et_EE.n3 [VIVO]/languages/et_EE/rdf/tbox/firsttime/vitroAnnotations/applicationMetadata/firsttime/classgroups_labels_et_EE.n3 |
In each file, labels specify text to be used by VIVO. Each label should be translated and affixed with the appropriate locale tag. See below:
Code Block | ||
---|---|---|
| ||
<http://vivoweb.org/ontology#vitroClassGrouppeople>
<http://www.w3.org/2000/01/rdf-schema#label> "inimesed"@et-EE .
<http://vivoweb.org/ontology#vitroClassGrouppublications>
<http://www.w3.org/2000/01/rdf-schema#label> "teadus"@et-EE .
<http://vivoweb.org/ontology#vitroClassGrouporganizations>
<http://www.w3.org/2000/01/rdf-schema#label> "organisatsioonid"@et-EE .
<http://vivoweb.org/ontology#vitroClassGroupactivities>
<http://www.w3.org/2000/01/rdf-schema#label> "tegevused"@et-EE . |
If you allow the user to select a preferred language, you must supply an image for the user to click on. Typically, this image is of the flag of the country(or the language) where the language is spoken.
Here are the locations you need to add the flag of the language:
You need to add the image to the themes you will be using. Here the path to the image that will load with wilma:
Code Block | ||
---|---|---|
| ||
VIVO-languages/webapp/src/main/webapp/themes/wilma/i18n/images/select_locale_et_EE.gif |
Panel | ||
---|---|---|
| ||
[VIVO]/languages/et_EE/rdf/i18n/et_EE/applicationMetadata/firsttime/propertygroups_labels_et_EE.n3
[VIVO]/languages/et_EE/rdf/i18n/et_EE/display/everytime/PropertyConfig_et_EE.n3
[VIVO]/languages/et_EE/rdf/i18n/et_EE/display/firsttime/aboutPage_et_EE.n3
[VIVO]/languages/et_EE/rdf/i18n/et_EE/display/firsttime/menu_et_EE.n3
[VIVO]/languages/et_EE/rdf/i18n/et_EE/tbox/firsttime/vitroAnnotations_et_EE.n3 |
In each file, labels specify text to be used by VIVO. Each label should be translated and affixed with the appropriate locale tag. See below:
Code Block | ||
---|---|---|
| ||
<http://vivoweb.org/ontology#vitroClassGrouppeople>
<http://www.w3.org/2000/01/rdf-schema#label> "inimesed"@et-EE .
<http://vivoweb.org/ontology#vitroClassGrouppublications>
<http://www.w3.org/2000/01/rdf-schema#label> "teadus"@et-EE .
<http://vivoweb.org/ontology#vitroClassGrouporganizations>
<http://www.w3.org/2000/01/rdf-schema#label> "organisatsioonid"@et-EE .
<http://vivoweb.org/ontology#vitroClassGroupactivities>
<http://www.w3.org/2000/01/rdf-schema#label> "tegevused"@et-EE . |
...
User's preferred locale | displayed text |
---|---|
en_UK | colouring |
en_CA | colouring |
es_MX | colorear |
fr_FR | coloring |
...
coloring |
...
Note | ||
---|---|---|
| ||
"Internationalization" is frequently abbreviated as "I18n", because the word is so long that there are 18 letters between the first "I" and the last "n". |
In In the I18n framework, displayed text strings are not embedded in the Java classes or in the Freemarker template. Instead, each piece of text is assigned a "key" and the code will ask the framework to provide the text string that is associated with that key. The framework has access to sets of properties files, one set for each supported language, and it will use the appropriate set to get the correct strings.
...
The text strings are processed by the Java I18n framework for message formats. Here is a tutorial on message formats. Full details can be found in the description of the MessageFormat class.
...
Code Block | ||
---|---|---|
| ||
if ( area == "global" ) { text = " " + i18nStrings.countriesAndRegions; } else if ( area == "country" ) { text = text = " " + i18nStrings.statesString; } |
...
" " + i18nStrings.statesString;
} |
Warning | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
This functionality was removed in the 1.12 release (
|
i18nChecker is a set of Ruby scripts that are distributed with VIVO, in the the utilities/languageSupport/i18nChecker
directory. Use them to scan your language properties files and your freemarker templates. The scripts look for common errors in the files.
...
...