Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hi there,
I have a problem with translation fields:

1)
$t['bulk_action_with_selected'] - selectbox - BULK ACTION WITH SELECTION
$t['bulk_action'] - selectbox - BULK ACTION WITH SELECTION
$t['apply'] - button APPLY - is only in english but the are translated to CS language in CS.php file.

2) Posts in table list are in this format Feb 6th 2018 but I need to translate it - I try to copy rows from updated EN.php like $t['month01'] and update functions.php too but nothing happend, language is EN. :roll: I try to change format to 06.02.2018, but i don't know where to do this.

Please help.
Hi,

It is not clear from your post but I assume that you are using your own 'couch/lang/CS.php' file for translation.
Once you have specified 'CS" language in couch/config.php (directive no. 22), Couch should pick up all values it can find from CS.php - those that are not found will be taken from the default EN.php. Is that not what is happening?

As for the dates, you'll need to get the version of Couch available at GitHub (https://github.com/CouchCMS/CouchCMS) .
However, that will only change the months shown in the publish-date 'dropdown'. To show localized dates in admin-listing will require a bit more work (specifically, theme override the date outputting function). Let me know and I'll try to come up with something for you.
About langs - I tried check EN.php and compare fields with CS.php but it is still nto working :/ Please, look at the attachment, where is a problem.

About date - dropdown date is okay but better will be if I somehow change date format in list - Feb 15 2018 to 15.02.2018 - Its possible? Please, type me some manual about this.

Attachments

Hi,
About langs - I tried check EN.php and compare fields with CS.php but it is still nto working :/ Please, look at the attachment, where is a problem.
Please see viewtopic.php?f=4&t=11382&p=30106#p30106

About date - dropdown date is okay but better will be if I somehow change date format in list - Feb 15 2018 to 15.02.2018 - Its possible?
Yes. You'll have to upgrade to the version of Couch available currently at GitHub (v2.1b as of this post).

Once that is done, please edit your 'couch/addons/kfunctions.php' file (if this file is not found, rename kfunctions.example.php to this name) and paste the following code in it -
Code: Select all
class MyOverrides{
    static function override_renderables(){
        global $FUNCS;

        $FUNCS->override_render( 'list_date', array('renderable'=>'MyOverrides::_render_list_date') );
        $FUNCS->override_render( 'list_mod_date', array('renderable'=>'MyOverrides::_render_list_mod_date') );
    }

    static function _render_list_date(){
        global $CTX, $FUNCS;

        $publish_date = $CTX->get( 'k_page_date' );

        if( $publish_date != '0000-00-00 00:00:00' ){
            $html = $FUNCS->date( $publish_date, "M jS Y" );
        }
        else{
            $html = '<span class="label label-error">'.$FUNCS->t('unpublished').'</span>';
        }

        return $html;
    }

    static function _render_list_mod_date(){
        global $CTX, $FUNCS;

        $mod_date = $CTX->get( 'modification_date' );
        $html = $FUNCS->date( $mod_date, "M jS Y @ H:i" );

        return $html;
    }
}
$FUNCS->add_event_listener( 'override_renderables', array('MyOverrides', 'override_renderables') );

The code above is overriding the core functions inside Couch which are outputting the dates in admin listing pages (there are actually two formats of dates used - one for normal pages and the other used in 'Drafts' listing).

You won't, however, see any difference just yet in the admin-panel because the code above is actually exactly duplicating the format logic used by Couch core. It does give you a single place where you can change the date formats easily and safely.

To do that, edit these two lines in the code we pasted above -
Code: Select all
$html = $FUNCS->date( $publish_date, "M jS Y" );

Code: Select all
$html = $FUNCS->date( $mod_date, "M jS Y @ H:i" );

and change the "M jS Y" and "M jS Y @ H:i" strings to whatever format you desire.

The details of that format is found at - http://docs.couchcms.com/tags-reference/date.html

For example, I changed the format to -
Code: Select all
$html = $FUNCS->date( $publish_date, "d.m.Y" );

Code: Select all
$html = $FUNCS->date( $mod_date, "d.m.Y @ H:i" );

and this is how the dates show up in my admin panel -
Untitled-1.png
Untitled-1.png (4.41 KiB) Viewed 176 times

As you can see, instead of Feb 15 2018, its is now 15.02.2018 which you wanted.

Hope it helps.
Thanks a lot, man. ;)
You are welcome :)
Alternative, zero-php, Couch-user-friendly, manageable and fun way of doing this can be found in my tutorial: viewtopic.php?f=8&t=11394 :)
7 posts Page 1 of 1

Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 6 guests

cron