3 use SL::GenericTranslations;
8 $main::lxdebug->enter_sub();
10 $main::auth->assert('config');
12 my $form = $main::form;
13 my $locale = $main::locale;
15 $form->get_lists('languages' => 'LANGUAGES');
17 my $translation_list = GenericTranslations->list();
18 my %translations = ();
20 my @types = qw(male female);
22 foreach my $translation (@{ $translation_list }) {
23 $translation->{language_id} ||= 'default';
24 $translations{$translation->{language_id} . '::' . $translation->{translation_type}} = $translation;
27 unshift @{ $form->{LANGUAGES} }, { 'id' => 'default', };
29 foreach my $language (@{ $form->{LANGUAGES} }) {
30 foreach my $type (@types) {
31 $language->{$type} = { };
32 my $translation = $translations{"$language->{id}::greetings::${type}"} || { };
33 $language->{$type} = $translation->{translation};
37 $form->{title} = $locale->text('Edit greetings');
39 print $form->parse_html_template('generictranslations/edit_greetings');
41 $main::lxdebug->leave_sub();
45 $main::lxdebug->enter_sub();
47 $main::auth->assert('config');
49 my $form = $main::form;
50 my $locale = $main::locale;
52 $form->get_lists('languages' => 'LANGUAGES');
54 unshift @{ $form->{LANGUAGES} }, { };
56 my @types = qw(male female);
58 foreach my $language (@{ $form->{LANGUAGES} }) {
59 foreach my $type (@types) {
60 GenericTranslations->save('translation_type' => "greetings::${type}",
61 'translation_id' => undef,
62 'language_id' => $language->{id},
63 'translation' => $form->{"translation__" . ($language->{id} || 'default') . "__${type}"},);
67 $form->{message} = $locale->text('The greetings have been saved.');
71 $main::lxdebug->leave_sub();
74 sub edit_sepa_strings {
75 $main::lxdebug->enter_sub();
77 $main::auth->assert('config');
79 my $form = $main::form;
80 my $locale = $main::locale;
82 $form->get_lists('languages' => 'LANGUAGES');
84 my $translation_list = GenericTranslations->list(translation_type => 'sepa_remittance_info_pfx');
85 my %translations = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list };
87 unshift @{ $form->{LANGUAGES} }, { 'id' => 'default', };
89 foreach my $language (@{ $form->{LANGUAGES} }) {
90 $language->{translation} = $translations{$language->{id}};
93 $form->{title} = $locale->text('Edit SEPA strings');
95 print $form->parse_html_template('generictranslations/edit_sepa_strings');
97 $main::lxdebug->leave_sub();
100 sub save_sepa_strings {
101 $main::lxdebug->enter_sub();
103 $main::auth->assert('config');
105 my $form = $main::form;
106 my $locale = $main::locale;
108 $form->get_lists('languages' => 'LANGUAGES');
110 unshift @{ $form->{LANGUAGES} }, { };
112 foreach my $language (@{ $form->{LANGUAGES} }) {
113 GenericTranslations->save('translation_type' => 'sepa_remittance_info_pfx',
114 'translation_id' => undef,
115 'language_id' => $language->{id},
116 'translation' => $form->{"translation__" . ($language->{id} || 'default')},);
119 $form->{message} = $locale->text('The SEPA strings have been saved.');
123 $main::lxdebug->leave_sub();