Permalink
Browse files

Try to fix the javascript gettext translations. Refs #20

  • Loading branch information...
1 parent 1ae7d94 commit 5926a7845a2a4e671a2868df8b0681e32a53d137 @hvorragend hvorragend committed Dec 27, 2011
@@ -328,8 +328,8 @@ function savedraft()
$('news_status_info').show();
$('news_saving_draft').show();
- $('news_status_text').update(Zikula.__('Saving quick draft...','module_news'));
- $('news_button_text_draft').update(Zikula.__('Saving quick draft...','module_news'));
+ $('news_status_text').update(Zikula.__('Saving quick draft...','module_news_js'));
+ $('news_button_text_draft').update(Zikula.__('Saving quick draft...','module_news_js'));
new Zikula.Ajax.Request(
'ajax.php?module=news&func=savedraft',
{
@@ -342,15 +342,15 @@ function savedraft_update(req)
{
$('news_saving_draft').hide();
if(!req.isSuccess()) {
- $('news_button_text_draft').update(Zikula.__('Save quick draft','module_news'));
- $('news_status_text').update(Zikula.__('Save quick draft failed','module_news'));
+ $('news_button_text_draft').update(Zikula.__('Save quick draft','module_news_js'));
+ $('news_status_text').update(Zikula.__('Save quick draft failed','module_news_js'));
Zikula.showajaxerror(req.getMessage());
return;
}
var data = req.getData();
draftsaved = true;
- $('news_button_text_draft').update(Zikula.__('Update quick draft','module_news'));
+ $('news_button_text_draft').update(Zikula.__('Update quick draft','module_news_js'));
$('news_status_text').update(data.result);
$('news_urltitle').value = data.slug;
$('news_sid').value = data.sid;
@@ -367,7 +367,7 @@ function showfilesaddedwarning()
if (filecount>0) {
$('news_button_fulldraft').addClassName('z-btgreen');
$('news_picture_warning').show();
- $('news_picture_warning_text').update(Zikula.__("Picture/file operations not supported in 'Quick draft' mode. You must click the 'Save full draft' button to complete these operations.",'module_news'));
+ $('news_picture_warning_text').update(Zikula.__("Picture/file operations not supported in 'Quick draft' mode. You must click the 'Save full draft' button to complete these operations.",'module_news_js'));
}
}
@@ -376,7 +376,7 @@ function news_isdraft()
var sid = $F('news_sid');
if (sid != '') {
draftsaved = true;
- $('news_button_text_draft').update(Zikula.__('Update quick draft','module_news'));
+ $('news_button_text_draft').update(Zikula.__('Update quick draft','module_news_js'));
}
return;
}
@@ -406,7 +406,7 @@ function news_expiration_init()
if ($('news_unlimited').checked == true) {
$('news_expiration_details').hide();
} else if ($('news_button_text_publish')) {
- $('news_button_text_publish').update(Zikula.__('Schedule','module_news'));
+ $('news_button_text_publish').update(Zikula.__('Schedule','module_news_js'));
}
$('news_unlimited').observe('click', news_unlimited_onchange);
$('news_tonolimit').observe('click', news_tonolimit_onchange);
@@ -416,9 +416,9 @@ function news_unlimited_onchange()
{
switchdisplaystate('news_expiration_details');
if ($('news_button_text_publish') && $('news_expiration_details').style.display != "none") {
- $('news_button_text_publish').update(Zikula.__('Publish','module_news'));
+ $('news_button_text_publish').update(Zikula.__('Publish','module_news_js'));
} else {
- $('news_button_text_publish').update(Zikula.__('Schedule','module_news'));
+ $('news_button_text_publish').update(Zikula.__('Schedule','module_news_js'));
}
}
@@ -435,25 +435,25 @@ function news_publication_init()
// show the publication details when a variable is not set to default
if ($('news_unlimited').checked == true && $('news_displayonindex').checked == true && $('news_allowcomments').checked == true) {
$('news_publication_collapse').removeClassName('z-toggle-link-open');
- $('news_publication_showhide').update(Zikula.__('Show','module_news'));
+ $('news_publication_showhide').update(Zikula.__('Show','module_news_js'));
$('news_publication_details').hide();
} else {
$('news_publication_collapse').addClassName('z-toggle-link-open');
- $('news_publication_showhide').update(Zikula.__('Hide','module_news'));
+ $('news_publication_showhide').update(Zikula.__('Hide','module_news_js'));
}
if ($('news_button_text_publish') && $('news_unlimited').checked == false) {
- $('news_button_text_publish').update(Zikula.__('Schedule','module_news'));
+ $('news_button_text_publish').update(Zikula.__('Schedule','module_news_js'));
}
}
function news_publication_click()
{
if ($('news_publication_details').style.display != "none") {
Element.removeClassName.delay(0.9, $('news_publication_collapse'), 'z-toggle-link-open');
- $('news_publication_showhide').update(Zikula.__('Show','module_news'));
+ $('news_publication_showhide').update(Zikula.__('Show','module_news_js'));
} else {
$('news_publication_collapse').addClassName('z-toggle-link-open');
- $('news_publication_showhide').update(Zikula.__('Hide','module_news'));
+ $('news_publication_showhide').update(Zikula.__('Hide','module_news_js'));
}
switchdisplaystate('news_publication_details');
}
@@ -466,10 +466,10 @@ function news_attributes_init()
// show attributes if they already exist
if ($F('attributecount') > 0) {
$('news_attributes_collapse').addClassName('z-toggle-link-open');
- $('news_attributes_showhide').update(Zikula.__('Hide','module_news'));
+ $('news_attributes_showhide').update(Zikula.__('Hide','module_news_js'));
} else {
$('news_attributes_collapse').removeClassName('z-toggle-link-open');
- $('news_attributes_showhide').update(Zikula.__('Show','module_news'));
+ $('news_attributes_showhide').update(Zikula.__('Show','module_news_js'));
$('news_attributes_details').hide();
}
}
@@ -478,10 +478,10 @@ function news_attributes_click()
{
if ($('news_attributes_details').style.display != "none") {
Element.removeClassName.delay(0.9, $('news_attributes_collapse'), 'z-toggle-link-open');
- $('news_attributes_showhide').update(Zikula.__('Show','module_news'));
+ $('news_attributes_showhide').update(Zikula.__('Show','module_news_js'));
} else {
$('news_attributes_collapse').addClassName('z-toggle-link-open');
- $('news_attributes_showhide').update(Zikula.__('Hide','module_news'));
+ $('news_attributes_showhide').update(Zikula.__('Hide','module_news_js'));
}
switchdisplaystate('news_attributes_details');
}
@@ -492,7 +492,7 @@ function news_notes_init()
$('news_notes_collapse').addClassName('z-toggle-link');
if ($('news_notes_details').style.display != "none") {
$('news_notes_collapse').removeClassName('z-toggle-link-open');
- $('news_notes_showhide').update(Zikula.__('Show','module_news'));
+ $('news_notes_showhide').update(Zikula.__('Show','module_news_js'));
$('news_notes_details').hide();
}
}
@@ -501,10 +501,10 @@ function news_notes_click()
{
if ($('news_notes_details').style.display != "none") {
Element.removeClassName.delay(0.9, $('news_notes_collapse'), 'z-toggle-link-open');
- $('news_notes_showhide').update(Zikula.__('Show','module_news'));
+ $('news_notes_showhide').update(Zikula.__('Show','module_news_js'));
} else {
$('news_notes_collapse').addClassName('z-toggle-link-open');
- $('news_notes_showhide').update(Zikula.__('Hide','module_news'));
+ $('news_notes_showhide').update(Zikula.__('Hide','module_news_js'));
}
switchdisplaystate('news_notes_details');
}
@@ -37,14 +37,14 @@ function news_admin_bulkaction_init()
var action=$F('news_bulkaction_select');
var actionmap=new Array(6);
actionmap[0]=null;
- actionmap[1]=Zikula.__('delete','module_news');
- actionmap[2]=Zikula.__('archive','module_news');
- actionmap[3]=Zikula.__('publish','module_news');
- actionmap[4]=Zikula.__('reject','module_news');
- actionmap[5]=Zikula.__('change categories for','module_news');
+ actionmap[1]=Zikula.__('delete','module_news_js');
+ actionmap[2]=Zikula.__('archive','module_news_js');
+ actionmap[3]=Zikula.__('publish','module_news_js');
+ actionmap[4]=Zikula.__('reject','module_news_js');
+ actionmap[5]=Zikula.__('change categories for','module_news_js');
var actionword=actionmap[action];
if (actionword=='delete') {
- var deletemessage='<br /><br /><strong class="z-warningmsg">'+Zikula.__('You cannot undo this operation!','module_news')+'</strong>';
+ var deletemessage='<br /><br /><strong class="z-warningmsg">'+Zikula.__('You cannot undo this operation!','module_news_js')+'</strong>';
} else {
var deletemessage='';
}
@@ -66,8 +66,8 @@ function news_admin_bulkaction_init()
'Are you sure you want to %s the following articles',
hvorragend
hvorragend Dec 27, 2011 Member

This one doesn't work, too.

The entire "are you sure..:" sentence is missing.
I just see the following in the dialog window:

: 3,4,6,8,9,10,11,12,13,14,15,16,17,18,19

The title is successful translated.


If I change 'module_news_js' to 'module_news' then I see the original english string, but with translated "action string".

"Are you sure you want to LÖSCHEN the following articles"
valuescount,
['<strong>'+actionword+'</strong>'],
- 'module_news')+': '+values+deletemessage,
- Zikula.__('Confirm Bulk Action','module_news'),
+ 'module_news_js')+': '+values+deletemessage,
+ Zikula.__('Confirm Bulk Action','module_news_js'),
executeform,
options
);
@@ -84,8 +84,8 @@ function news_admin_bulkaction_init()
// no articles selected
$('news_bulkaction_select').selectedIndex=0;
Zikula.UI.Alert(
- Zikula.__f('Please select at least one article to %s.',actionword,'module_news'),
- Zikula.__('Bulk action error','module_news')
+ Zikula.__f('Please select at least one article to %s.',actionword,'module_news_js'),
+ Zikula.__('Bulk action error','module_news_js')
);
}
});
@@ -1,3 +1,4 @@
+{pageaddvar name="jsgettext" value="module_news_js:News"}
{ajaxheader module="News" ui=true}
{gt text="All These Categories" assign="allText"}
{nocache}
@@ -20,7 +21,7 @@
var news___CATEGORIES____{{$property}}_ = new Zikula.UI.SelectMultiple(
'news___CATEGORIES____{{$property}}_',
{opener: 'news___CATEGORIES____{{$property}}__open',
- okLabel: Zikula.__('Done!','module_news'),
+ okLabel: Zikula.__('Done!','module_news_js'),
value: '{{news_implode value=$selectedValue}}',
excludeValues: ['0']}
);
@@ -1,4 +1,5 @@
{ajaxheader modname='News' filename='news.js'}
+{pageaddvar name="jsgettext" value="module_news_js:News"}
{pageaddvar name='javascript' value='modules/News/javascript/sizecheck.js'}
{pageaddvar name='javascript' value='modules/News/javascript/prototype-base-extensions.js'}
{pageaddvar name='javascript' value='modules/News/javascript/prototype-date-extensions.js'}
@@ -10,7 +11,7 @@
{/if}
<script type="text/javascript">
// <![CDATA[
- var bytesused = Zikula.__f('%s characters out of 4,294,967,295','#{chars}','module_news');
+ var bytesused = Zikula.__f('%s characters out of 4,294,967,295','#{chars}','module_news_js');
// ]]>
</script>
@@ -1,3 +1,4 @@
+{pageaddvar name="jsgettext" value="module_news_js:News"}
<input type="hidden" name="csrftoken" value="{insert name='csrftoken'}" />
<input type="hidden" name="story[sid]" id='news_sid' value="{$item.sid|safetext}" />
<input type="hidden" name="page" value="{$page|safetext}" />
@@ -215,7 +216,7 @@
{gt text='Contributed by'} <span id='news_contributor'>{$item.contributor}</span> {gt text='on'} {$item.cr_date|dateformat} <a id="news_cr_uid_edit" href="{modurl modname='News' type='admin' func='selectuser' id=$item.cr_uid}">{img modname='core' set='icons/extrasmall' src='xedit.png' __title='Edit' __alt='Edit'}</a>
<input type="hidden" id="news_cr_uid" name="story[cr_uid]" value="{$item.cr_uid}" />
<script type="text/javascript">
- var options = {modal:true,draggable:false,resizable:false,initMaxHeight:220,title:Zikula.__('Article Author','module_news')};
+ var options = {modal:true,draggable:false,resizable:false,initMaxHeight:220,title:Zikula.__('Article Author','module_news_js')};
hvorragend
hvorragend Dec 27, 2011 Member

The Gettext extractor on community.zikula.org doesn't extract this string.
@drak : Do you have an idea?

espaan
espaan Dec 27, 2011 Member

And the strings in
src/modules/News/templates/user/articlecontent.tpl
and
src/modules/News/templates/user/create.tpl
are extracted fine?

hvorragend
hvorragend Dec 27, 2011 Member

I don't know.

hvorragend
hvorragend Dec 27, 2011 Member

Now I know it.
The same problem. The translation is missing there, too.

craigh
craigh Dec 27, 2011 Owner

In order to work there is a line that must be added to the template. At least that's what the core ticket said. Did you add that before trying? I don't think it has been added to the code yet...

craigh
craigh Dec 27, 2011 Owner

Oops. Isee that is the purpose of this commit :P

hvorragend
hvorragend Dec 27, 2011 Member

So it is ;-)

hvorragend
hvorragend Apr 16, 2012 Member

It looks like there is something wrong with the Gettext extractor at http://community.zikula.org/module-Gettext.htm

I created a new POT file in 217a35c, but all these javascript strings are missing.

Just search for the example strings like:

  • Article Author
  • %s characters out of 4,294,967,295

Refs zikula-modules/Gettext#3

var userselectwindow = new Zikula.UI.FormDialog($('news_cr_uid_edit'),executeuserselectform,options);
</script>
</li>
@@ -1,4 +1,5 @@
{ajaxheader modname='News' filename='news_admin.js' ui=true}
+{pageaddvar name="jsgettext" value="module_news_js:News"}
{adminheader}
<div class="z-admin-content-pagetitle">
@@ -1,17 +1,18 @@
+{pageaddvar name="jsgettext" value="module_news_js:News"}
<h2>{gt text='Edit news article'}: {$item.title|safetext}</h2>
<form id="news_ajax_modifyform" class="z-form" action="{modurl modname='News' type='admin' func='update'}" method="post" enctype="{if $accesspicupload AND $modvars.News.picupload_enabled}multipart/form-data{else}application/x-www-form-urlencoded{/if}">
<div>
{include file='admin/modify_subform.tpl'}
<div class="z-buttonrow z-buttons z-center">
- <a href="javascript:void(0);" onclick="editnews_save('update');" class="z-btgreen">{img src='button_ok.png' modname='core' set='icons/extrasmall' __alt='Save quick edit' __title='Save your quick changes' } {gt text='Save quick edit' domain='module_news'}</a>
- <button type='submit' name="story[action]" value='2' class="z-btgreen" title="{gt text='Save full edit'}">{img src='button_ok.png' modname='core' set='icons/extrasmall' __alt='Save full edit' __title='Save all changes' } {gt text='Save full edit' domain='module_news'}</button>
- <a href="javascript:void(0);" onclick="editnews_save('pending');">{img modname='core' src='clock.png' set='icons/extrasmall' __alt='Mark as pending' __title='Mark this article as pending'} {gt text='Mark as pending' domain='module_news'}</a>
+ <a href="javascript:void(0);" onclick="editnews_save('update');" class="z-btgreen">{img src='button_ok.png' modname='core' set='icons/extrasmall' __alt='Save quick edit' __title='Save your quick changes' } {gt text='Save quick edit'}</a>
+ <button type='submit' name="story[action]" value='2' class="z-btgreen" title="{gt text='Save full edit'}">{img src='button_ok.png' modname='core' set='icons/extrasmall' __alt='Save full edit' __title='Save all changes' } {gt text='Save full edit'}</button>
+ <a href="javascript:void(0);" onclick="editnews_save('pending');">{img modname='core' src='clock.png' set='icons/extrasmall' __alt='Mark as pending' __title='Mark this article as pending'} {gt text='Mark as pending'}</a>
{checkpermissionblock component='News::' instance="$item.cr_uid::$item.sid" level='ACCESS_DELETE'}
- <a href="javascript:void(0);" onclick="editnews_save('delete');" class="z-btred">{img modname='core' src='editdelete.png' set='icons/extrasmall' __alt='Delete' __title='Delete this article'} {gt text='Delete' domain='module_news'}</a>
+ <a href="javascript:void(0);" onclick="editnews_save('delete');" class="z-btred">{img modname='core' src='editdelete.png' set='icons/extrasmall' __alt='Delete' __title='Delete this article'} {gt text='Delete'}</a>
{/checkpermissionblock}
- <a href="javascript:void(0);" onclick="editnews_cancel();" class="z-btred">{img modname='core' src='button_cancel.png' set='icons/extrasmall' __alt='Cancel' __title='Cancel'} {gt text='Cancel' domain='module_news'}</a>
+ <a href="javascript:void(0);" onclick="editnews_cancel();" class="z-btred">{img modname='core' src='button_cancel.png' set='icons/extrasmall' __alt='Cancel' __title='Cancel'} {gt text='Cancel'}</a>
&nbsp;<img id="news_savenews" src="{$baseurl}images/ajax/circle-ball-dark-antialiased.gif" alt="" />
</div>
</div>
@@ -1,4 +1,4 @@
<div>
<input type="checkbox" id="active_news" name="active[News]" value="1"{if $active}checked="checked"{/if} />
- <label for="active_news">{gt text='News articles' domain='module_news'}</label>
+ <label for="active_news">{gt text='News articles'}</label>
</div>
@@ -1,6 +1,7 @@
+{pageaddvar name="jsgettext" value="module_news_js:News"}
<script type="text/javascript">
// <![CDATA[
- var bytesused = Zikula.__f('%s characters out of 4,294,967,295','#{chars}','module_news');
+ var bytesused = Zikula.__f('%s characters out of 4,294,967,295','#{chars}','module_news_js');
// ]]>
</script>
@@ -2,6 +2,7 @@
{insert name='getstatusmsg'}
{ajaxheader modname='News' filename='news.js'}
+{pageaddvar name="jsgettext" value="module_news_js:News"}
{pageaddvar name='javascript' value='modules/News/javascript/sizecheck.js'}
{pageaddvar name='javascript' value='modules/News/javascript/prototype-base-extensions.js'}
{pageaddvar name='javascript' value='modules/News/javascript/prototype-date-extensions.js'}
@@ -14,7 +15,7 @@
<script type="text/javascript">
// <![CDATA[
- var bytesused = Zikula.__f('%s characters out of 4,294,967,295','#{chars}','module_news');
+ var bytesused = Zikula.__f('%s characters out of 4,294,967,295','#{chars}','module_news_js');
// ]]>
</script>

0 comments on commit 5926a78

Please sign in to comment.