Localization

Colectica Repository can be translated to other languages. This functionality can also be used to change the text that is displayed for any reason. For example, your organization may wish to use different words to refer to metadata items (e.g., “Sweeps” instead of “Studies”).

Colectica Repository determines the language of the user interface using these priorities:

  1. If the user has selected an interface language from the top navigation bar, use that.

  2. If the user’s browser sends an Accept-Language header supported by Repository, use that.

  3. Use the default language specified in the server’s appsettings.json file.

To localize Colectica Repository web portal, complete the following steps.

Localize the Content

Note

See https://github.com/Colectica/ColecticaPortal.LocalizationStarter for a project template that includes everything you need to translate Colectica Portal.

Note

The localization project can be edited and built with the free Visual Studio Community Edition.

To translate these resources to a new language:

  1. Rename the two resource files with the appropriate language. For example, if you are translating to Danish, you can rename the two files in the Resources folder to DdiItemStrings.da.resx and PortalStrings.da.resx.

  2. Edit the text in the resource files with your translations.

Build the Localization Assembly

  1. Build the project. This should create a file named bin/Debug/net5.0/languageColecticaRepository.resources.dll.

Deploy and Configure your Localization

To test your localized resources:

  1. Create a folder inside your Colectica Portal deployment directory. The folder should have the same name as your language (e.g., da\ for Danish).

  2. Copy the bin/Debug/net5.0/language/ColecticaResources.resources.dll file into this folder.

  3. Update the SupportedLanguages and Language settings in appsettings.json with the code of the language you wish to use.

  4. Restart the Colectica Repository application.

Localize Email Notifications

Note

Default email message content are shipped in the Colectica Portal’s \Config-dist\EmailTemplates-dist folder.

To translate these resources to a new language:

  1. Move the email content JSON files from the distribution’s \Config-dist\EmailTemplates-dist folder to the Portal’s \Config\EmailTemplates folder in the install location.

  2. Edit the text in the JSON files with your translations.

Note

Be sure to properly escape the translated strings to conform to the JSON standard for string encoding. The following characters are reserved in JSON and must be properly escaped to be used in strings:

  • Backspace is replaced with \b

  • Form feed is replaced with f

  • Newline is replaced with \n

  • Carriage return is replaced with \r

  • Tab is replaced with \t

  • Double quote is replaced with "

  • Backslash is replaced with \