From 68e901d98c08e45c7291c3caf4b15462d0c72eec Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Sat, 3 Dec 2005 16:31:24 +0000 Subject: [PATCH] done with i18n. --- lib/WebGUI/Asset/Field.pm | 4 +- lib/WebGUI/Asset/Shortcut.pm | 99 +++------ lib/WebGUI/Asset/Wobject/MultiSearch.pm | 2 +- lib/WebGUI/Asset/Wobject/WeatherData.pm | 11 +- lib/WebGUI/i18n/English/Asset_Shortcut.pm | 110 +++++++++- lib/WebGUI/i18n/English/Asset_WeatherData.pm | 212 ++----------------- 6 files changed, 154 insertions(+), 284 deletions(-) diff --git a/lib/WebGUI/Asset/Field.pm b/lib/WebGUI/Asset/Field.pm index 854df154c..a74368af6 100644 --- a/lib/WebGUI/Asset/Field.pm +++ b/lib/WebGUI/Asset/Field.pm @@ -71,8 +71,8 @@ sub definition { fieldType=>{fieldType=>'fieldType',defaultValue=>'',label=>$i18n->get('Type of Field'),types=>['text','textarea','checkList','selectList']}, # overrideForm=>{fieldType=>'yesNo',defaultValue=>0}, # overrideValue=>{fieldType=>'yesNo',defaultValue=>0}, - possibleValues=>{fieldType=>'textarea',defaultValue=>'',label=>$i18n->get('Possible values for this Field. Only applies to selectList and checkList.')}, - defaultValue=>{fieldType=>'textarea',defaultValue=>'',label=>$i18n->get('Default Value for this field.')} + possibleValues=>{fieldType=>'textarea',defaultValue=>'',label=>$i18n->get('Possible values'),hoverHelp=>$i18n->get('Possible values for this Field Only applies to selectList and checkList')}, + defaultValue=>{fieldType=>'textarea',defaultValue=>'',label=>$i18n->get('Default Value for this field')} ); push(@{$definition}, { diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 9f52e8dcf..e1e1c2e2b 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -145,7 +145,9 @@ sub _submenu { my $ac = WebGUI::AdminConsole->new("shortcutmanager"); $ac->setHelp($help) if ($help); $ac->setIcon($self->getIcon); - $ac->addSubmenuItem($self->getUrl('func=edit'), "Back to Edit Shortcut"); + $ac->addSubmenuItem($self->getUrl('func=edit'), WebGUI::International::get("Back to Edit Shortcut","Asset_Shortcut")); + $ac->addSubmenuItem($self->getUrl("func=manageOverrides"),WebGUI::International::get("Manage Shortcut Overrides","Asset_Shortcut")); + $ac->addSubmenuItem($self->getUrl("func=manageUserPrefs"),WebGUI::International::get("Manage User Preferences","Asset_Shortcut")); return $ac->render($workarea, $title); } @@ -220,10 +222,10 @@ sub definition { description=>{ fieldType=>"HTMLArea", defaultValue=>undef - }, - } - }); - return $class->SUPER::definition($definition); + }, + } + }); + return $class->SUPER::definition($definition); } @@ -233,55 +235,7 @@ sub getEditForm { my $self = shift; my $tabform = $self->SUPER::getEditForm(); my $originalTemplate; -# $tabform->getTab("properties")->HTMLArea( -# -value=>$self->getValue("description"), -# -label=>WebGUI::International::get(85, 'Asset_Shortcut'), -# -hoverHelp=>WebGUI::International::get('85 description', 'Asset_Shortcut'), -# -name=>"description" -# ); -# $tabform->getTab("display")->template( -# -value=>$self->getValue("templateId"), -# -label=>WebGUI::International::get('shortcut template title', 'Asset_Shortcut'), -# -hoverHelp=>WebGUI::International::get('shortcut template title description', 'Asset_Shortcut'), -# -namespace=>"Shortcut" -# ); -# if ($self->getShortcut->get("templateId")) { -# $originalTemplate = WebGUI::Asset::Template->new($self->getShortcut->get("templateId")); -# $originalTemplate = WebGUI::Asset::Template->new($self->getShortcut->get("collaborationTemplateId")) if (ref $self->getShortcut eq "WebGUI::Asset::Wobject::Collaboration"); -# #Shortcuts of Posts and Threads and other assets without a "templateId" -# # are going to be ->view'ed by their original parent's settings anyway. -# $tabform->getTab("display")->template( -# -name=>"overrideTemplateId", -# -value=>$self->getValue("overrideTemplateId") || $originalTemplate->getId, -# -label=>WebGUI::International::get('override asset template', 'Asset_Shortcut'), -# -hoverHelp=>WebGUI::International::get('override asset template description', 'Asset_Shortcut'), -# -namespace=>$originalTemplate->get("namespace") -# ); -# $tabform->getTab("display")->yesNo( -# -name=>"overrideTemplate", -# -value=>$self->getValue("overrideTemplate"), -# -label=>WebGUI::International::get(10,"Asset_Shortcut"), -# -hoverHelp=>WebGUI::International::get('10 description',"Asset_Shortcut") -# ); -# } -# $tabform->getTab("properties")->yesNo( -# -name=>"overrideTitle", -# -value=>$self->getValue("overrideTitle"), -# -label=>WebGUI::International::get(7,"Asset_Shortcut"), -# -hoverHelp=>WebGUI::International::get('7 description',"Asset_Shortcut") -# ); -# $tabform->getTab("display")->yesNo( -# -name=>"overrideDisplayTitle", -# -value=>$self->getValue("overrideDisplayTitle"), -# -label=>WebGUI::International::get(8,"Asset_Shortcut"), -# -hoverHelp=>WebGUI::International::get('8 description',"Asset_Shortcut") -# ); -# $tabform->getTab("properties")->yesNo( -# -name=>"overrideDescription", -# -value=>$self->getValue("overrideDescription"), -# -label=>WebGUI::International::get(9,"Asset_Shortcut"), -# -hoverHelp=>WebGUI::International::get('9 description',"Asset_Shortcut") -# ); + my $i18n = WebGUI::International->new("Asset_Shortcut"); $tabform->getTab("properties")->readOnly( -label=>WebGUI::International::get(1,"Asset_Shortcut"), -hoverHelp=>WebGUI::International::get('1 description',"Asset_Shortcut"), @@ -329,7 +283,7 @@ sub getEditForm { -hoverHelp=>WebGUI::International::get("Criteria description","Asset_Shortcut") ); } - $tabform->addTab('overrides','Overrides'); + $tabform->addTab('overrides',$i18n->get('Overrides')); $tabform->getTab('overrides')->raw($self->getOverridesList); return $tabform; } @@ -351,12 +305,13 @@ sub getExtraHeadTags { #------------------------------------------------------------------- sub getFieldsList { my $self = shift; - my $output = 'Add Preference Field

'; + my $i18n = WebGUI::International->new("Asset_Shortcut"); + my $output = ''.$i18n->get('Add Preference Field').'

'; my @fielden; @fielden = $self->getUserPrefs; return $output unless scalar @fielden > 0; $output .= ''; - $output .= ''; + $output .= ''; foreach my $field (@fielden) { $output .= ''; $output .= ''; @@ -374,9 +329,10 @@ sub getFieldsList { sub getOverridesList { my $self = shift; my $output = ''; + my $i18n = WebGUI::International->new("Asset_Shortcut"); my %overrides = $self->getOverrides; $output .= '
fieldNameEdit/Delete
'.$i18n->get('fieldName').''.$i18n->get('edit delete fieldname').'
'.$field->get("fieldName").'
'; - $output .= ''; + $output .= ''; foreach my $definition (@{$self->getShortcutOriginal->definition}) { foreach my $prop (keys %{$definition->{properties}}) { next if $definition->{properties}{$prop}{fieldType} eq 'hidden'; @@ -438,7 +394,6 @@ sub getOverrides { } $cache->set(\%overrides, 60*60); $overridesRef = \%overrides; - # use Data::Dumper;WebGUI::ErrorHandler::warn('
'.Dumper($overridesRef).'
'); } return %$overridesRef; } @@ -633,7 +588,7 @@ sub view { my $content; my $shortcut = $self->getShortcut; if ($self->get("shortcutToAssetId") eq $self->get("parentId")) { - $content = "Displaying this shortcut would cause a feedback loop."; + $content = WebGUI::International::get("Displaying this shortcut would cause a feedback loop","Asset_Shortcut"); } else { $content = $shortcut->view; } @@ -651,7 +606,8 @@ sub www_edit { my $self = shift; return WebGUI::Privilege::insufficient() unless $self->canEdit; $self->getAdminConsole->setHelp("shortcut add/edit","Asset_Shortcut"); - $self->getAdminConsole->addSubmenuItem($self->getUrl("func=manageOverrides"),"Manage Shortcut Overrides"); + $self->getAdminConsole->addSubmenuItem($self->getUrl("func=manageOverrides"),WebGUI::International::get("Manage Shortcut Overrides","Asset_Shortcut")); + $self->getAdminConsole->addSubmenuItem($self->getUrl("func=manageUserPrefs"),WebGUI::International::get("Manage User Preferences","Asset_Shortcut")); return $self->getAdminConsole->render($self->getEditForm->print,WebGUI::International::get(2,"Asset_Shortcut")); } @@ -693,14 +649,14 @@ sub www_manageUserPrefs { my $self = shift; return WebGUI::Privilege::insufficient() unless $self->canEdit; my $output = $self->getFieldsList; - return $self->_submenu($output,"Manage Preferences"); + return $self->_submenu($output,WebGUI::International::get("Manage User Preferences","Asset_Shortcut")); } #------------------------------------------------------------------- sub www_manageOverrides { my $self = shift; return WebGUI::Privilege::insufficient() unless $self->canEdit; - return $self->_submenu($self->getOverridesList,'Manage Overrides'); + return $self->_submenu($self->getOverridesList,WebGUI::International::get("Manage Shortcut Overrides","Asset_Shortcut")); } #------------------------------------------------------------------- @@ -745,6 +701,7 @@ sub www_getNewTitle { sub www_editOverride { my $self = shift; return WebGUI::Privilege::insufficient() unless $self->canEdit; + my $i18n = WebGUI::International->new("Asset_Shortcut"); my $fieldName = $session{form}{fieldName}; my %overrides = $self->getOverrides; my $output = ''; @@ -756,8 +713,8 @@ sub www_editOverride { my $f = WebGUI::HTMLForm->new(-action=>$self->getUrl); $f->hidden(-name=>"func",-value=>"saveOverride"); $f->hidden(-name=>"overrideFieldName",-value=>$session{form}{fieldName}); - $f->readOnly(-label=>"Field Name",-value=>$session{form}{fieldName}); - $f->readOnly(-label=>"Original Value",-value=>$overrides{overrides}{$fieldName}{origValue}); + $f->readOnly(-label=>$i18n->get("Field Name"),-value=>$session{form}{fieldName}); + $f->readOnly(-label=>$i18n->get("Original Value"),-value=>$overrides{overrides}{$fieldName}{origValue}); my %params; foreach my $key (keys %{$props{$fieldName}}) { next if ($key eq "tab"); @@ -765,20 +722,20 @@ sub www_editOverride { } $params{value} = $overrides{overrides}{$fieldName}{origValue}; $params{name} = $fieldName; - $params{label} = $params{label} || "Edit Field Directly"; - $params{hoverhelp} = $params{hoverhelp} || "Use this field to edit the override using the native form handler for this field type."; + $params{label} = $params{label} || $i18n->get("Edit Field Directly"); + $params{hoverhelp} = $params{hoverhelp} || $i18n->get("Use this field to edit the override using the native form handler for this field type"); if ($fieldName eq 'templateId') {$params{namespace} = $params{namespace} || WebGUI::Asset->newByDynamicClass($overrides{overrides}{templateId}{origValue})->get("namespace");} $f->dynamicField(%params); $f->textarea( -name=>"newOverrideValueText", - -label=>"New Override Value", + -label=>$i18n->get("New Override Value"), -value=>$overrides{overrides}{$fieldName}{newValue}, - -hoverHelp=>"Place something in this box if you don't want to use the automatically generated field." + -hoverHelp=>$i18n->get("Place something in this box if you dont want to use the automatically generated field") ); - $f->readOnly(-label=>"Replacement Value",-value=>$overrides{overrides}{$fieldName}{parsedValue}); + $f->readOnly(-label=>$i18n->get("Replacement Value"),-value=>$overrides{overrides}{$fieldName}{parsedValue},-hoverHelp=>$i18n->get("This is the example output of the field when parsed for user preference macros")); $f->submit; $output .= $f->print; - return $self->_submenu($output,'Edit Override'); + return $self->_submenu($output,$i18n->get('Edit Override')); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/MultiSearch.pm b/lib/WebGUI/Asset/Wobject/MultiSearch.pm index 74baef55e..48615f253 100644 --- a/lib/WebGUI/Asset/Wobject/MultiSearch.pm +++ b/lib/WebGUI/Asset/Wobject/MultiSearch.pm @@ -86,7 +86,7 @@ sub view { #Set some template variables #Build list of searches as an array - my $defaults = $self->getValue("predefinedSearches"); +# my $defaults = $self->getValue("predefinedSearches"); return $self->processTemplate(\%var, $self->get("templateId")); } diff --git a/lib/WebGUI/Asset/Wobject/WeatherData.pm b/lib/WebGUI/Asset/Wobject/WeatherData.pm index 932afb0cc..00bb52400 100644 --- a/lib/WebGUI/Asset/Wobject/WeatherData.pm +++ b/lib/WebGUI/Asset/Wobject/WeatherData.pm @@ -45,27 +45,28 @@ defines wobject properties for WeatherData instances sub definition { my $class = shift; my $definition = shift; + my $i18n = WebGUI::International->new("Asset_WeatherData"); my $properties = { templateId =>{ fieldType=>"template", tab=>"display", defaultValue=>'WeatherDataTmpl0000001', namespace=>"WeatherData", - hoverHelp=>WebGUI::International::get('article template description','Asset_Article'), - label=>WebGUI::International::get(72,"Asset_Article") + hoverHelp=>$i18n->get("Current Weather Conditions Template to use"), + label=>$i18n->get("Template") }, locations=>{ fieldType=>"textarea", defaultValue=>"Grayslake,IL", tab=>"properties", - hoverHelp=>WebGUI::International::get('article template description','Asset_Article'), - label=>WebGUI::International::get(72,"Asset_Article") + hoverHelp=>$i18n->get("Your list of default weather locations"), + label=>$i18n->get("Default Locations") }, }; push(@{$definition}, { tableName=>'WeatherData', className=>'WebGUI::Asset::Wobject::WeatherData', - assetName=>'WeatherData', + assetName=>$i18n->get("WeatherData"), icon=>'weatherData.gif', autoGenerateForms=>1, properties=>$properties diff --git a/lib/WebGUI/i18n/English/Asset_Shortcut.pm b/lib/WebGUI/i18n/English/Asset_Shortcut.pm index 8b09a8156..e8186087b 100644 --- a/lib/WebGUI/i18n/English/Asset_Shortcut.pm +++ b/lib/WebGUI/i18n/English/Asset_Shortcut.pm @@ -226,20 +226,17 @@ The word "Shortcut".

lastUpdated => 1133619940, }, - -# ----------------------------------------------- - 'Label for This Field.' => { message => q|Label for This Field.|, lastUpdated => 1133619940, }, - 'Possible values for this Field. Only applies to selectList and checkList.' => { - message => q|Possible values for this Field. Only applies to selectList and checkList.|, + 'Possible Values' => { + message => q|Possible Values|, lastUpdated => 1133619940, }, - 'Default Value for this field.' => { + 'Default Value for this field' => { message => q|Default Value for this field.|, lastUpdated => 1133619940, }, @@ -269,6 +266,107 @@ The word "Shortcut".

lastUpdated => 1133619940, }, + 'Back to Edit Shortcut' => { + message => q|Back to Edit Shortcut|, + lastUpdated => 1133619940, + }, + + + 'Overrides' => { + message => q|Overrides|, + lastUpdated => 1133619940, + }, + + 'Add Preference Field' => { + message => q|Add Preference Field|, + lastUpdated => 1133619940, + }, + + 'fieldName' => { + message => q|Field Name|, + lastUpdated => 1133619940, + }, + + 'edit delete fieldname' => { + message => q|Edit/Delete Fieldname|, + lastUpdated => 1133619940, + }, + + 'Original Value' => { + message => q|Original Value|, + lastUpdated => 1133619940, + }, + + 'Replacement value' => { + message => q|Replacement value|, + lastUpdated => 1133619940, + }, + + 'New value' => { + message => q|New value|, + lastUpdated => 1133619940, + }, + + 'Displaying this shortcut would cause a feedback loop' => { + message => q|Displaying this shortcut would cause a feedback loop.|, + lastUpdated => 1133619940, + }, + + 'Manage Shortcut Overrides' => { + message => q|Manage Shortcut Overrides|, + lastUpdated => 1133619940, + }, + + 'Manage User Preferences' => { + message => q|Manage User Preferences|, + lastUpdated => 1133619940, + }, + + 'Edit Field Directly' => { + message => q|Edit Field Directly|, + lastUpdated => 1133619940, + }, + + 'Use this field to edit the override using the native form handler for this field type' => { + message => q|Use this field to edit the override using the native form handler for this field type|, + lastUpdated => 1133619940, + }, + + 'New Override Value' => { + message => q|New Override Value|, + lastUpdated => 1133619940, + }, + + 'Place something in this box if you dont want to use the automatically generated field' => { + message => q|Place something in this box if you don't want to use the automatically generated field. You may also insert user preference values into this field by using the following syntax: if you wanted it to display "My Favorite color is blue.", and you have a user preference field called myFavColor, in this box you would put: My Favorite color is ##userPref:myFavColor##.|, + lastUpdated => 1133619940, + }, + + 'Replacement Value' => { + message => q|Replacement Value|, + lastUpdated => 1133619940, + }, + + 'Edit Override' => { + message => q|Edit Override|, + lastUpdated => 1133619940, + }, + + 'Possible values for this Field Only applies to selectList and checkList' => { + message => q|Possible values for this Field. Only applies to selectList and checkList.|, + lastUpdated => 1133619940, + }, + + 'Label for This Field' => { + message => q|Label for This Field|, + lastUpdated => 1133619940, + }, + + 'Label for This Field' => { + message => q|Label for This Field|, + lastUpdated => 1133619940, + }, + }; 1; diff --git a/lib/WebGUI/i18n/English/Asset_WeatherData.pm b/lib/WebGUI/i18n/English/Asset_WeatherData.pm index ac627a3ca..03f830daa 100644 --- a/lib/WebGUI/i18n/English/Asset_WeatherData.pm +++ b/lib/WebGUI/i18n/English/Asset_WeatherData.pm @@ -1,211 +1,25 @@ package WebGUI::i18n::English::Asset_Article; our $I18N = { - '11' => { - message => q|(Select "Yes" only if you aren't adding <br> manually.)|, - lastUpdated => 1031514049 + + 'Current Weather Conditions Template to use' => { + message => q|Current Weather Conditions Template to use|, + lastUpdated => 1133619940, }, - '71' => { - message => q|

Articles are the Swiss Army knife of WebGUI. Most pieces of static content can be added via the Article. ARticles are Wobjects, so they inherit the properties of both Wobjects and Assets. -

- -NOTE: You can create a multi-paged article by placing the separator macro (^-;) at various places through-out your article. This works unless you are using a Make Page Printable style. - -|, - lastUpdated => 1119066571, + 'Template' => { + message => q|Template|, + lastUpdated => 1133619940, }, - '7' => { - message => q|Link Title|, - lastUpdated => 1031514049 + 'Your list of default weather locations' => { + message => q|Your list of default weather locations, each on its own line. Use City, ST or zipCode.|, + lastUpdated => 1133619940, }, - 'link title description' => { - message => q|If you wish to add a link to your article, enter the title of the link in this field. -

-Example: Google|, - lastUpdated => 1119066359 - }, - - - 'assetName' => { - message => q|Article|, - lastUpdated => 1128830974 - }, - - '72' => { - message => q|Article Template|, - lastUpdated => 1038794871 - }, - - 'article template description' => { - message => q|Select a template from the list to layout your Wobject. Each Wobject -may only use templates for their own namespace. For example, Articles -can only use templates from the "Article" namespace. Layouts can only -use templates from the "page" namespace.|, - lastUpdated => 1119066250 - }, - - - '28' => { - message => q|View Responses|, - lastUpdated => 1031514049 - }, - - '61' => { - message => q|Article, Add/Edit|, - lastUpdated => 1066583066 - }, - - '12' => { - message => q|Edit Article|, - lastUpdated => 1031514049 - }, - - '8' => { - message => q|Link URL|, - lastUpdated => 1031514049 - }, - - 'link url description' => { - message => q|If you added a link title, now add the URL (uniform resource locater) here. -

-Example: http://www.google.com|, - lastUpdated => 1119066412 - }, - - - '73' => { - message => q|The following template variables are available for article templates. -

- -new.template
-Articles have the special ability to change their template so that you can allow users to see different views of the article. You do this by creating a link with a URL like this (replace 999 with the template Id you wish to use):

-<a href="<tmpl_var new.template>999">Read more...</a> -

-description
-The paginated description. -

- -description.full
-The full description without any pagination. -

- -description.first.100words
-The first 100 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words. -

- -description.first.75words
-The first 75 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words. -

- -description.first.50words
-The first 50 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words. -

- -description.first.25words
-The first 25 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words. -

- -description.first.10words
-The first 10 words in the description. Words are defined as characters separated by whitespace, so HTML entities and tags count as words. -

- -description.first.paragraph
-The first paragraph of the description. The first paragraph is determined by the first carriage return found in the text. -

- -description.first.2paragraphs
-The first two paragraphs of the description. A paragraph is determined by counting the carriage returns found in the text. -

- -description.first.sentence
-The first sentence in the description. A sentence is determined by counting the periods found in the text. -

- -description.first.2sentences
-The first two sentences in the description. A sentence is determined by counting the periods found in the text. -

- -description.first.3sentences
-The first three sentences in the description. A sentence is determined by counting the periods found in the text. -

- -description.first.4sentences
-The first four sentences in the description. A sentence is determined by counting the periods found in the text. -

- - -attachment.box
-Outputs a standard WebGUI attachment box including icon, filename, and attachment indicator. -

- -attachment.icon
-The URL to the icon image for this attachment type. -

- -attachment.name
-The filename for this attachment. -

- -attachment.url
-The URL to download this attachment. -

- -image.thumbnail
-The URL to the thumbnail for the attached image. -

- -image.url
-The URL to the attached image. -

- -linkTitle
-The title of the link added to the article. -

- -linkURL
-The URL for the link added to the article. -

- -post.label
-The translated label to add a comment to this article. -

- -post.URL
-The URL to add a comment to this article. -

- -replies.count
-The number of comments attached to this article. -

- -replies.label
-The translated text indicating that you can view the replies. -

- -replies.url
-The URL to view the replies to this article. -

-|, - lastUpdated => 1106783944 - }, - - '24' => { - message => q|Post Response|, - lastUpdated => 1031514049 - }, - - '10' => { - message => q|Convert carriage returns?|, - lastUpdated => 1031514049 - }, - - 'carriage return description' => { - message => q| -If you're publishing HTML there's generally no need to check this option, but if you aren't using HTML and you want a carriage return every place you hit your "Enter" key, then check this option.|, - lastUpdated => 1119066524 + 'Default Locations' => { + message => q|Default Location(s)|, + lastUpdated => 1133619940, },

fieldNameEdit/DeleteOriginal ValueNew ValueReplacement value
'.$i18n->get('fieldName').''.$i18n->get('edit delete fieldname').''.$i18n->get('Original Value').''.$i18n->get('New value').''.$i18n->get('Replacement value').'