Multilanguage translation support

To create a translation for the template file we have to create a separate file:

  • XYZ_translations_strings.json
  • xyzWidget.pm

In the installation process, XYZ_translations_strings.json is being merged to the global translations list. Depends on the user preferences strings a system iterate over the right prefix and look for appropriate translations.  Look on the example below:

  • XYZ_translations_strings.json
[
	"Contract number",
	"Contract name",
	"Remaining time",
	"Support start date",
	"Support end date",
	"Number of hours in the support",
	"Service information",
	"left",
	"exceeded",
	"h",
	"No service assigned",
	"Contract loading..."
]
  • pl_xyzWidget.pm

Be careful correctly type the module path!

package Kernel::Language::pl_xyzWidget;

use strict;
use warnings;
use utf8;
use vars qw(@ISA $VERSION);

sub Data {
    my $Self = shift;

	$Self->{Translation}->{"Contract loading..."} = "Ładowanie kontraktu...";
    $Self->{Translation}->{"Contract number"} = "Numer kontraktu";
	$Self->{Translation}->{"Contract name"} = "Nazwa kontraktu";
	$Self->{Translation}->{"Remaining time"} = "Pozostały czas";
	$Self->{Translation}->{"Support start date"} = "Początek wsparcia";
	$Self->{Translation}->{"Support end date"} = "Koniec wsparcia";
	$Self->{Translation}->{"Number of hours in the support"} = "Godziny w ramach wsparcia";
	$Self->{Translation}->{"Service information"} = "Informacje o usłudze";
	$Self->{Translation}->{"left"} = "pozostało";
	$Self->{Translation}->{"exceeded"} = "przekroczono";
	$Self->{Translation}->{"h"} = "godz.";
    $Self->{Translation}->{"No service assigned"} = "Brak przypisanej usługi";

    return 1;
	}
1;