Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi, I'm working on polish translation but EN.php doesn't have words to translate like name of months. How to change that?
Below example of DRAFTs section.
It looks like for now you would have to change the core files. I found this on line 1524 of couch/functions.php. Notice the comment, TODO: allow localization. You will have to decide if it's worth it to change and then maintain those changes to the core files.
Code: Select all
        function date_dropdowns( $date='', $simple_mode=0 ){
            global $FUNCS, $PAGE;
            //TODO: allow localization
            $arrMonths = array('01'=>'January',   '02'=>'February', '03'=>'March',    '04'=>'April',
                               '05'=>'May',       '06'=>'June',     '07'=>'July',     '08'=>'August',
                               '09'=>'September', '10'=>'October',  '11'=>'November', '12'=>'December');

Perhaps @KK could get this into v2.1 before it exits beta. In couch/lang/EN.php, we could add:
Code: Select all
    $t['month01'] = 'January';
    $t['month02'] = 'February';
    $t['month03'] = 'March';
    $t['month04'] = 'April';
    $t['month05'] = 'May';
    $t['month06'] = 'June';
    $t['month07'] = 'July';
    $t['month08'] = 'August';
    $t['month09'] = 'September';
    $t['month10'] = 'October';
    $t['month11'] = 'November';
    $t['month12'] = 'December';

The other language files would also need to be updated. Then the code in couch/functions.php would be changed to:
Code: Select all
        function date_dropdowns( $date='', $simple_mode=0 ){
            global $FUNCS, $PAGE;
            //TODO: allow localization
            $arrMonths = array('01'=>$FUNCS->t('month01'), '02'=>$FUNCS->t('month02'), '03'=>$FUNCS->t('month03'), '04'=>$FUNCS->t('month04'),
                               '05'=>$FUNCS->t('month05'), '06'=>$FUNCS->t('month06'), '07'=>$FUNCS->t('month07'), '08'=>$FUNCS->t('month08'),
                               '09'=>$FUNCS->t('month09'), '10'=>$FUNCS->t('month10'), '11'=>$FUNCS->t('month11'), '12'=>$FUNCS->t('month12'));

I believe that is all that is necessary to localize the dropdown months. In fact, you can try it for yourself and see that it works.
Changing lines in functions.php working well (I've changed four first months for test)
but as you say, it would be much better to add this to EN.php

I saw second thing about translations. In example below DRAFTs have english modification date "Jan" - january etc + "st", "nd", "th" that in example in Poland we use only formats like below (on screenshot example Jan 25th 2018 @ 11:48):
25 sty 2018 @ 11:48 (sty = styczeń = jan = january)
25.01.2018 @ 11:48 (day.month.year)
This should be added too to translation or just add in options changing date formats for universal 25.01.2018 or 01.25.2018.
Localization of dropdown dates has been added to the core files. Grab the most recent Couch version from GitHub (you should only really need to update couch/functions.php and couch/lang/EN.php if you are already using v2.1 beta). Then add the correct month names to your Polish language file.
I have another situation with months:

Code: Select all

<cms:set month01 = "Январь" />
<cms:set month02 = "Февраль" />
<cms:set month03 = "Март" />
<cms:set month04 = "Апрель" />
<cms:set month05 = "Май" />
<cms:set month06 = "Июнь" />
<cms:set month07 = "Июль" />
<cms:set month08 = "Август" />
<cms:set month09 = "Сентябрь" />
<cms:set month10 = "Октябрь" />
<cms:set month11 = "Ноябрь" />
<cms:set month12 = "Декабрь" />

      <cms:persist k_publish_date="<cms:show frm_my_publish_date />" />

      <cms:field 'my_publish_date' label=seminar_data>
         <cms:input name=k_field_input_name type='datetime' format='ymd' fields_separator=',' default_time="<cms:if k_cur_form_mode='edit' && k_page_date!='0000-00-00 00:00:00'><cms:show k_page_date /><cms:else />@current</cms:if>" required='1' months="<cms:show month01 />, <cms:show month02 />, <cms:show month03 />, <cms:show month04 />, <cms:show month05 />, <cms:show month06 />, <cms:show month07 />, <cms:show month08 />, <cms:show month09 />, <cms:show month10 />, <cms:show month11 />, <cms:show month12 />" />

but in admin panel i have error:

Code: Select all
ERROR: Tag "datetime" - 'months' attribute requires 12 months.

without "month" param i have:


in config.php
Code: Select all
define( 'K_ADMIN_LANG', 'RU' );

in lang/RU.php

Code: Select all
   $t['month01'] = 'Январь';
        $t['month02'] = 'Февраль';
        $t['month03'] = 'Март';
        $t['month04'] = 'Апрель';
        $t['month05'] = 'Май';
        $t['month06'] = 'Июнь';
        $t['month07'] = 'Июль';
        $t['month08'] = 'Август';
        $t['month09'] = 'Сентябрь';
        $t['month10'] = 'Октябрь';
        $t['month11'] = 'Ноябрь';
   $t['month12'] = 'Декабрь';

in functions.php
Code: Select all

         $arrMonths = array(

I have multi-language admin panel, can't use static month labels
5 posts Page 1 of 1

Who is online

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

Users browsing this forum: No registered users and 3 guests