Integrations

Translations

This document describes how to create an official standard translation and how to create a custom translation for your own system.

Workflow

Before you start working on an official translation you should verify that no other translator is already working with your language - contact the project managers via the contact form on this site in the first instance.

Make sure you have the latest SVN revision of ResourceSpace. You probably have to update ResourceSpace several times during your work with the translation.

Make all translations.

Create a dbstruct file for the site texts.

Add suitable stop words in config.default.php (commented out as default).

If you have a subversion account you could commit the changed files (don't forget to write a comment that makes sense). If you don't have a subversion account you should upload the changed files to the Google Group and ask someone to commit the files.

You may then go back and correct errors you or other users eventually find and also add new translations when new $lang indices appear.

Standard translation

All standard site text will fall into one of four categories; main application's texts, plugin applications' texts, site content texts and icons, which are all described below. A stop word list (included in config.default.php) should also be included in a complete translation.

Translating main application text

In the "languages" folder, one file must exist per language. If the file does not exist you should copy en.php (it is always complete) and save it with a new name and .php as the file name extension. The name shall be the ISO 639-1 code for your language with a suffix for the country if needed (e.g. sv.php, pt-BR.php).

If the file already exists your first step is to make sure it is complete. Compare it with the en.php and copy missing lines if needed.

Open the file in a standard text editor. The file shall be saved in UTF-8 without BOM.

The text after the equals sign is the text that must be translated. If the $lang is prefixed with a # you have to remove that. The # just means that the $lang is copied from the template but not yet translated.

The language must be added to the language list in the "config.default.php" file.

Translating plugin text

In the "plugins" folder, there may exist a "languages" folder (not all plugins use extra texts). Follow the same instructions as above.

Translating site content

Go to the "Admin" menu then "System" and choose "Site Content". For each content item, you can use the language drop-down box to select the appropriate language version to edit.

If contributing back to the base, you can use /pages/tools/site_text_to_lang.php?lang=(lang) to output the override text in a format compatible with the language files.

No preview icons

These icons are located in the folder gfx/no_preview/resource_type

They are shown if the preview is missing for the resource and there is no file type icon for that particular extension. The filenames of the icons shall be suffixed with the ISO 639-1 code for your language (with an additional suffix for the country if needed). E.g. type1_col_sv.png

Metadata template icons

These icons are located in the folder gfx/no_preview/extension

The filenames of the icons shall be suffixed with the ISO 639-1 code for your language (with an additional suffix for the country if needed). E.g. mdtr_es.png

Saved search icon

This icon is located in the folder gfx/images

The filename of the icon shall be suffixed with the ISO 639-1 code for your language (with an additional suffix for the country if needed). E.g. save-search_sv.gif

Translating help files

In the folder documentation there is a help file named permissions.txt

You may create a new file in your language. The filename of the new file shall be suffixed with the ISO 639-1 code for your language (with an additional suffix for the country if needed). E.g. permissions_sv.txt

Don't forget to update the $lang["documentation-permissions"] to link to the new file.

Adding a stop word list

Open config.default.php in a text editor. Search for the section with search parameters. Add a comment like this (replace the words between [] with relevant data):

# [language] stop words

Add a line like this (shall be commented out) below the other similar lines. You are not limited to three words, it's just an example.#$noadd=array_merge($noadd, array("[word1", "[word2]", "[word3]"));

The system administrators shall copy all needed stop word lists to config.php and uncomment these.

Creating multi-lingual custom field names, resource type names, field values

The default field names, resource type names, user group names, report names etc. are translated in the language file. For custom field names, resource type names, field values etc., it may be appropriate for your installation to create these in one language only. However, if multiple language support is required for these areas also, it is possible to use a special syntax when naming these elements to support multiple languages. In System Setup, when naming custom fields, resource type names, field values etc. the following syntax can be used:

~en:Digital Camera~sv:Digitalkamera, ~en:Scanned Negative~sv:Skannat negativ, ~en:Scanned Photo~sv:Skannat fotografi

Take care not to include any additional spaces other than those required between your translated words.

When the source is displayed by the system, for English the text may read "Digital Camera" and for Swedish the text then will read "Digitalkamera". Additionally when indexing, both values will be indexed so both are searchable, therefore searching using either language will work. Note that if the fields are mapped to a file metadata field (e.g. an IPTC field) and the resource is downloaded the field will be exported in its full length, e.g. "~en:Digital Camera~sv:Digitalkamera".