diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 0fcd840bc..9dc7d2d0d 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -1,6 +1,10 @@ 6.7.0 - Added the ability to override the UI Level of any field in the edit form of any asset in the WebGUI config file. + - Translation providers can now add languageAbbreviation and locale + properties to their translation in order to activate the translations of + javascript helper components like the rich editor and the calendar + date picker. - Added the ability to override the UI Level of an entire asset in the config file. - fix [ 1229042 ] crumbtrail should show full path... diff --git a/lib/WebGUI/Asset/RichEdit.pm b/lib/WebGUI/Asset/RichEdit.pm index 4db79c13a..c6eda5a3a 100644 --- a/lib/WebGUI/Asset/RichEdit.pm +++ b/lib/WebGUI/Asset/RichEdit.pm @@ -452,6 +452,11 @@ sub getRichEditor { push(@plugins,"") if ($button eq ""); push(@plugins,"") if ($button eq ""); } + my $language = WebGUI::International::getLanguage($session{user}{language},"languageAbbreviation"); + unless ($language) { + $language = WebGUI::International::getLanguage("English","languageAbbreviation"); + } + $config{language} = $language; $config{content_css} = $self->getValue("cssFile") if ($self->getValue("cssFile") ne ""); $config{width} = $self->getValue("editorWidth") if ($self->getValue("editorWidth") > 0); $config{height} = $self->getValue("editorHeight") if ($self->getValue("editorHeight") > 0); diff --git a/lib/WebGUI/Form/Control.pm b/lib/WebGUI/Form/Control.pm index 79a6f5759..5992db758 100644 --- a/lib/WebGUI/Form/Control.pm +++ b/lib/WebGUI/Form/Control.pm @@ -93,6 +93,10 @@ A text label that will be displayed if toHtmlWithWrapper() is called. A unique identifier that can be used to identify this field with javascripts and cascading style sheets. Is autogenerated if not specified. The autogenerated version is the value of the name parameter concatinated with the string "_formId". So for a field called "title" it would be "title_formId". +=head4 idPrefix + +If specified, this will be prepended to the id (whether autogenerated or not) to prevent overlap of two similar forms on the same page. + =head4 uiLevel The UI Level that the user must meet or exceed if this field should be displayed with toHtmlWithWrapper() is called. @@ -166,6 +170,9 @@ sub definition { defaultValue=>undef }, id=>{ + defaultValue=>undef + }, + idPrefix=>{ defaultValue=>undef } }); @@ -352,6 +359,8 @@ sub new { unless ($params{id}) { $params{id} = $class->generateIdParameter($params{name}); } + # preventing ID collisions + $params{id} = $params{idPrefix}.$params{id}; bless \%params, $class; } diff --git a/lib/WebGUI/Form/date.pm b/lib/WebGUI/Form/date.pm index 8a0ceaf6e..569ada6bc 100644 --- a/lib/WebGUI/Form/date.pm +++ b/lib/WebGUI/Form/date.pm @@ -124,8 +124,12 @@ Renders a date picker control. sub toHtml { my $self = shift; my $value = WebGUI::DateTime::epochToSet($self->{value}) unless ($self->{noDate} && $self->{value} eq ''); + my $language = WebGUI::International::getLanguage($session{user}{language},"languageAbbreviation"); + unless ($language) { + $language = WebGUI::International::getLanguage("English","languageAbbreviation"); + } WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar.js',{ type=>'text/javascript' }); - WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/lang/calendar-en.js',{ type=>'text/javascript' }); + WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/lang/calendar-'.$language.'.js',{ type=>'text/javascript' }); WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar-setup.js',{ type=>'text/javascript' }); WebGUI::Style::setLink($session{config}{extrasURL}.'/calendar/calendar-win2k-1.css', { rel=>"stylesheet", type=>"text/css", media=>"all" }); my $mondayFirst = $session{user}{firstDayOfWeek} ? "true" : "false"; diff --git a/lib/WebGUI/Form/dateTime.pm b/lib/WebGUI/Form/dateTime.pm index 521b985ff..f4dd97645 100644 --- a/lib/WebGUI/Form/dateTime.pm +++ b/lib/WebGUI/Form/dateTime.pm @@ -117,8 +117,12 @@ Renders a date picker control. sub toHtml { my $self = shift; my $value = WebGUI::DateTime::epochToSet($self->{value},1); + my $language = WebGUI::International::getLanguage($session{user}{language},"languageAbbreviation"); + unless ($language) { + $language = WebGUI::International::getLanguage("English","languageAbbreviation"); + } WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar.js',{ type=>'text/javascript' }); - WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/lang/calendar-en.js',{ type=>'text/javascript' }); + WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/lang/calendar-'.$language.'.js',{ type=>'text/javascript' }); WebGUI::Style::setScript($session{config}{extrasURL}.'/calendar/calendar-setup.js',{ type=>'text/javascript' }); WebGUI::Style::setLink($session{config}{extrasURL}.'/calendar/calendar-win2k-1.css', { rel=>"stylesheet", type=>"text/css", media=>"all" }); my $mondayFirst = $session{user}{firstDayOfWeek} ? "true" : "false"; @@ -131,7 +135,7 @@ sub toHtml { maxlength=>$self->{maxlength} )->toHtml . '