Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Summary of this Page

Table of Contents
exclude.*Page*

VIVO Language Support

Excerpt

When a VIVO site supports a language other than English, that support includes:

  • Text that is displayed in the VIVO pages.  For example, menus, selections, prompts, tool-tips and plain text.
  • Text from terms in the Ontology, which are frequently displayed as links or section headings.  Text includes labels and annotations of properties and classes.
  • Text values stored in the data. For example, if a book title is available in both French and English, a French-speaking user sees the French title. If a title is available only in English, it is displayed, without regard to the user's preference in languages.

Languages can be selected in a variety of ways, depending on the installation parameters:

  • A VIVO

...

  • administrator can configure VIVO to use one of the supported languages.
  • Different users may see different languages, depending on the settings in their web browser.
  • Different users may select a language from a list of available languages.

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.

Adding an existing language to your VIVO site

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. 

  • Go into each language folder (VIVO-language and Vitro-language) and install them with Maven using mvn install
  • Edit the vivo_home_dir/config/runtime.properties file in your VIVO home directory:
    • uncomment/add RDFService.languageFilter = true
    • uncomment/add languages.selectableLocales = en_US, de_DE
  • Restart the tomcat
  • You should now be able to select your installed language (in this case German) in the header of your VIVO site

For more details, see Enabling Interface Languages in VIVO as an Administrator.

Building VIVO and Vitro language repositories from source (for developers)

  • Clone the VIVO-languages and Vitro-languages repositories to your local machine.
  • Ensure the <version> in the pom.xml files for VIVO and Vitro-languages matches the <version> of VIVO you are building against

    Go 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:

    • Vitro/installer/webapp/pom.xml (Uncomment dependencies and overlays)
    • VIVO/installer/home/pom.xml (Uncomment dependencies)
    • VIVO/installer/webapp/pom.xml(Uncomment dependencies and overlays)
    Change the <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.
  • Go into each language folder (VIVO-language and Vitro-language) and install them with Maven using mvn install
  • Build VIVO from the VIVO project folder using 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
  • Edit the vivo_home_dir/config/runtime.properties file in your VIVO home directory:
    • uncomment/add RDFService.languageFilter = true
    • uncomment/add languages.selectableLocales = en_US, de_DE
  • Restart the tomcat
  • You should now be able to select your installed language (in this case German) in the header of your VIVO site

...

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

...

  • in Vitro-languages/webapp/src/main/webapp/i18n
  • in VIVO-languages/webapp/src/main/webapp/i18n
  • in each theme's i18n directory. For instance : 
    • VIVO-languages/en_US/webapp/src/main/webapp/themes/tenderfoot/i18n and
    • VIVO-languages/en_US/webapp/src/main/webapp/themes/wilma/i18n

...

They are located in:

  • Vitro-languages/<locale>/webapp/src/main/webapp/templates/freemarker
  • VIVO-languages/<locale>/webapp/src/main/webapp/templates/freemarker/body
  • VIVO-languages/<locale>/webapp/src/main/webapp/templates/freemarker/visualization/capabilitymap
  • VIVO-languages/<locale>/webapp/src/main/webapp/templates/freemarker/visualization/mapOfScience

...

Code Block
titleExample file names
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

...

RDF data (.n3, .nt)

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:

  • VIVO-languages/home/src/main/resources/rdf/display/firsttimeVIVO-languages/<locale>/home/src/main/resources/rdf/tbox/everytime

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:

  • i18n/<locale>/applicationMetadata/everytime
  • VIVO-languages/<locale>/home/src/main/resources/rdf/i18n/<locale>/display/everytime
  • VIVO-languages/<locale>/home/src/main/resources/rdf/i18n/<locale>/display/firsttime
  • VIVO-languages/<locale>/home/src/main/resources/rdf/i18n/<locale>/tbox/everytime

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
titleFile names (Estonian)
Code Block
titleFile names (Estonian)
[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
titleSome classgroups_labels (Estonian)
<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 .

The selection image (.png, .jpeg, .gif)

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:

  • Vitro-languages/webapp/src/main/webapp/themes/vitro/i18n/images
  • VIVO-languages/webapp/src/main/webapp/themes/tenderfoot/i18n/images
  • VIVO-languages/webapp/src/main/webapp/themes/wilma/i18n/images

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
titleSelect Local Image File name (Estonian)
VIVO-languages/webapp/src/main/webapp/themes/wilma/i18n/images/select_locale_et_EE.gif
Panel
titleImage for locale selection (Estonian)

Image Removed


[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
titleSome classgroups_labels (Estonian)
<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 .

How VIVO supports languages

...

User's preferred localedisplayed text
en_UKcolouring
en_CAcolouring
es_MXcolorear
fr_FRcoloring

...

coloring

Language support in VIVO pages

...

Note
iconfalse

"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.

Local extension: application vs. theme

...

Code Block
titleExcerpt from homePageMaps.js
        if ( area == "global" ) {
            text = " " + i18nStrings.countriesAndRegions;
        }
        else if ( area == "country" ) {
            text =         text = " " + i18nStrings.statesString;
        }

...

" " + i18nStrings.statesString;
        }

i18nChecker

Warning

This functionality was removed in the 1.12 release (

Jira
serverLYRASIS JIRA
serverIdc815ca92-fd23-34c2-8fe3-956808caf8c5
keyVIVO-1753
). Based on the redesign of I18n, a new set of checkers should be created. See:
Jira
serverLYRASIS JIRA
serverIdc815ca92-fd23-34c2-8fe3-956808caf8c5
keyVIVO-1935

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.

...

  • Warn if a specialized file has no default version.
  • Warn about duplicate keys, keys with empty values.
  • Warn about keys that do not appear in the default version.
  • If the "complete" flag is set,
    • Warn if the default version is not found.
    • Warn about missing keys, compared to the default version.

Scanning Freemarker templates

...