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 my $translation_list_vc = GenericTranslations->list(translation_type => 'sepa_remittance_vc_no_pfx');
88 my %translations_vc = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list_vc };
90 unshift @{ $form->{LANGUAGES} }, { 'id' => 'default', };
92 foreach my $language (@{ $form->{LANGUAGES} }) {
93 $language->{translation} = $translations{$language->{id}};
94 $language->{translation_vc} = $translations_vc{$language->{id}};
97 $form->{title} = $locale->text('Edit SEPA strings');
99 print $form->parse_html_template('generictranslations/edit_sepa_strings');
101 $main::lxdebug->leave_sub();
104 sub save_sepa_strings {
105 $main::lxdebug->enter_sub();
107 $main::auth->assert('config');
109 my $form = $main::form;
110 my $locale = $main::locale;
112 $form->get_lists('languages' => 'LANGUAGES');
114 unshift @{ $form->{LANGUAGES} }, { };
116 foreach my $language (@{ $form->{LANGUAGES} }) {
117 GenericTranslations->save('translation_type' => 'sepa_remittance_info_pfx',
118 'translation_id' => undef,
119 'language_id' => $language->{id},
120 'translation' => $form->{"translation__" . ($language->{id} || 'default')},);
121 GenericTranslations->save('translation_type' => 'sepa_remittance_vc_no_pfx',
122 'translation_id' => undef,
123 'language_id' => $language->{id},
124 'translation' => $form->{"translation__" . ($language->{id} || 'default') . "__vc" },);
127 $form->{message} = $locale->text('The SEPA strings have been saved.');
131 $main::lxdebug->leave_sub();