3 use SL::GenericTranslations;
8 $auth->assert('config');
10 $form->get_lists('languages' => 'LANGUAGES');
12 my $translation_list = GenericTranslations->list();
13 my %translations = ();
15 my @types = qw(male female);
17 foreach my $translation (@{ $translation_list }) {
18 $translation->{language_id} ||= 'default';
19 $translations{$translation->{language_id} . '::' . $translation->{translation_type}} = $translation;
22 unshift @{ $form->{LANGUAGES} }, { 'id' => 'default', };
24 foreach my $language (@{ $form->{LANGUAGES} }) {
25 foreach my $type (@types) {
26 $language->{$type} = { };
27 my $translation = $translations{"$language->{id}::greetings::${type}"} || { };
28 $language->{$type} = $translation->{translation};
32 $form->{title} = $locale->text('Edit greetings');
34 print $form->parse_html_template('generictranslations/edit_greetings');
36 $lxdebug->leave_sub();
40 $lxdebug->enter_sub();
42 $auth->assert('config');
44 $form->get_lists('languages' => 'LANGUAGES');
46 unshift @{ $form->{LANGUAGES} }, { };
48 my @types = qw(male female);
50 foreach my $language (@{ $form->{LANGUAGES} }) {
51 foreach my $type (@types) {
52 GenericTranslations->save('translation_type' => "greetings::${type}",
53 'translation_id' => undef,
54 'language_id' => $language->{id},
55 'translation' => $form->{"translation__" . ($language->{id} || 'default') . "__${type}"},);
59 $form->{message} = $locale->text('The greetings have been saved.');
63 $lxdebug->leave_sub();