Simple Event (months) language
Permalink
Hi folks,
i'm building this site with finnish language and i need to change/translate
those months into finnish language.
How do i do that?
I have installed finnish language package fi_FI into Concrete5 but that did not change anything?
Where does Simple Event get those months name's?
I find en.xml (concrete/libraries/3rdparty/zend/locale/data/en.xml) and there i changed english months into finnish but that did not fix anything..
please help!
/ Mika
i'm building this site with finnish language and i need to change/translate
those months into finnish language.
How do i do that?
I have installed finnish language package fi_FI into Concrete5 but that did not change anything?
Where does Simple Event get those months name's?
I find en.xml (concrete/libraries/3rdparty/zend/locale/data/en.xml) and there i changed english months into finnish but that did not fix anything..
please help!
/ Mika
Do you want to translate just month names or a full date?
Hi,
full date would be great!! but month wil be ok too....
I have no glue what to do here....
Just help me!!! :-)
// M
full date would be great!! but month wil be ok too....
I have no glue what to do here....
Just help me!!! :-)
// M
I wrote an how-to about localization and dates: seehttp://www.concrete5.org/documentation/how-tos/developers/internati...
Hi,
here's my code so u see yourself what i'm talking about. And i want translate event date in to Finnish...
***
<?php
for($i=0;$i<count($eArray);$i++){
$event = $eArray[$i];
?>
<div class="cpagecal">
<div class="titlehead">
<div class="space">
</div>
<div class="title">
<?php
echo '<a href="'.$event->url.'">'.$event->title.'</a>' ;
?>
</div>
<div class="pvm">
<?php
echo $event->date.' - '.$event->todate ;
?>
</div>
</div>
</div>
<br class="clearfloat" />
<?php
}
?>
***
here's my code so u see yourself what i'm talking about. And i want translate event date in to Finnish...
***
<?php
for($i=0;$i<count($eArray);$i++){
$event = $eArray[$i];
?>
<div class="cpagecal">
<div class="titlehead">
<div class="space">
</div>
<div class="title">
<?php
echo '<a href="'.$event->url.'">'.$event->title.'</a>' ;
?>
</div>
<div class="pvm">
<?php
echo $event->date.' - '.$event->todate ;
?>
</div>
</div>
</div>
<br class="clearfloat" />
<?php
}
?>
***
Hi, mlocati.
thx for your help.
Can u give me more help cos i'm not php coder at all..
sincerely,
/ Mika
thx for your help.
Can u give me more help cos i'm not php coder at all..
sincerely,
/ Mika
What kind of help do you need?
Hi mlocati,
where is the place in C5 to translate to those months in to finnish by hand..
it that most simplest way to translate months?
/ Mika
where is the place in C5 to translate to those months in to finnish by hand..
it that most simplest way to translate months?
/ Mika
There's no simple way to translate months.
concrete5 uses Zend_Date to translate dates.
To translate only a month name first you have to build a Unix timestamp for a date/time that's for the month you want. For instance for August:
Then you can use the concrete5 datehelper (that makes use of ZendFramework 1 Zend_Data):
concrete5 uses Zend_Date to translate dates.
To translate only a month name first you have to build a Unix timestamp for a date/time that's for the month you want. For instance for August:
$timestamp = mktime(0, 0, 0, 8, 18, 2014);
Then you can use the concrete5 datehelper (that makes use of ZendFramework 1 Zend_Data):
$dh = Loader::helper('date'); echo $dh->date('F', $timestamp);
Hi,
i found file (Zend) where was all the months listed. I just tried to change all the month names in to finnish but that did not work out :-)
What is the first step that i have to do here?
// M
i found file (Zend) where was all the months listed. I just tried to change all the month names in to finnish but that did not work out :-)
What is the first step that i have to do here?
// M
You simply have to copy the PHP code that I wrote above...
Please remark that you need to have the current language set to Finnish (for this please browse the forums).
Please remark that you need to have the current language set to Finnish (for this please browse the forums).
Thx so mush for your help!
I got it allmost working with this code:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
?>
<!-- Piilotetaan listalta otsikko
<h1>?php echo $rssTitle?></h1>
-->
<?php
for($i=0;$i<count($eArray);$i++){
$event = $eArray[$i];
?>
<div class="cpagecal">
<div class="titlehead">
<div class="space">
</div>
<div class="title">
<?php
echo '<a href="'.$event->url.'">'.$event->title.'</a>' ;
?>
</div>
<div class="pvm">
<?php
$dh = Loader::helper('date');
echo $dh->date(DATE_APP_GENERIC_MDY_FULL, strtotime($event->date));' - '.$event->todate ;
?>
</div>
</div>
</div>
<br class="clearfloat" />
<?php
}
?>
<?php if($showfeed==1){ ?>
<div class="iCal">
<p><img src="<?php echo $controller->getRssIconUrl() ;?>" width="25" alt="iCal feed" />
<a href="<?php echo($controller->getiCalUrl());?>?ctID=<?php echo $ctID ;?>&bID=<?php echo $bID ; ?>&ordering=<?php echo $ordering ;?>" id="getFeed">
<?php echo t('get iCal link');?></a></p>
<link href="<?php echo $controller->getiCalUrl();?>" rel="alternate" type="application/rss+xml" title="<?php echo t('RSS');?>" />
</div>
<?php } ?>
<?php
if($isPaged==1){
$controller->showPagination();
}
?>
Only TODATE ($event->todate ; ) is not working..
do i have to do helper for it also?
like this:
$dh = Loader::helper('todate');
and
echo $dh->todate(DATE_APP_GENERIC_MDY_FULL, strtotime($event->todate));'
/ Mika
I got it allmost working with this code:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
?>
<!-- Piilotetaan listalta otsikko
<h1>?php echo $rssTitle?></h1>
-->
<?php
for($i=0;$i<count($eArray);$i++){
$event = $eArray[$i];
?>
<div class="cpagecal">
<div class="titlehead">
<div class="space">
</div>
<div class="title">
<?php
echo '<a href="'.$event->url.'">'.$event->title.'</a>' ;
?>
</div>
<div class="pvm">
<?php
$dh = Loader::helper('date');
echo $dh->date(DATE_APP_GENERIC_MDY_FULL, strtotime($event->date));' - '.$event->todate ;
?>
</div>
</div>
</div>
<br class="clearfloat" />
<?php
}
?>
<?php if($showfeed==1){ ?>
<div class="iCal">
<p><img src="<?php echo $controller->getRssIconUrl() ;?>" width="25" alt="iCal feed" />
<a href="<?php echo($controller->getiCalUrl());?>?ctID=<?php echo $ctID ;?>&bID=<?php echo $bID ; ?>&ordering=<?php echo $ordering ;?>" id="getFeed">
<?php echo t('get iCal link');?></a></p>
<link href="<?php echo $controller->getiCalUrl();?>" rel="alternate" type="application/rss+xml" title="<?php echo t('RSS');?>" />
</div>
<?php } ?>
<?php
if($isPaged==1){
$controller->showPagination();
}
?>
Only TODATE ($event->todate ; ) is not working..
do i have to do helper for it also?
like this:
$dh = Loader::helper('todate');
and
echo $dh->todate(DATE_APP_GENERIC_MDY_FULL, strtotime($event->todate));'
/ Mika
Thx for your help.
I just found out that there is more problems in Simple Event with Concrete5 with finnish language on so I was wondering if i'm able to work it out just adding ordinary Content Block content (DATE) before TITLE in Pagelist.
Where user just fills in page blocks and i get this as a result:
> 12.9.2014 - Lorem ipsum (content block - title)
> 10.8.2014 - Lorem ipsum
How do i do this?
/ Mika
I just found out that there is more problems in Simple Event with Concrete5 with finnish language on so I was wondering if i'm able to work it out just adding ordinary Content Block content (DATE) before TITLE in Pagelist.
Where user just fills in page blocks and i get this as a result:
> 12.9.2014 - Lorem ipsum (content block - title)
> 10.8.2014 - Lorem ipsum
How do i do this?
/ Mika
HI Mlocati,
how's things?
i have one more question about translating in C5 (ProBlog).
How do i translate only months (see attch file).
My config.php looks like this:
Here is my view.php code:
// Mika
how's things?
i have one more question about translating in C5 (ProBlog).
How do i translate only months (see attch file).
My config.php looks like this:
<?php define('DB_SERVER', 'xxx'); define('DB_USERNAME', 'xxx'); define('DB_PASSWORD', 'xxx'); define('DB_DATABASE', 'xxx'); define('PASSWORD_SALT', 'xxx'); define('LOCALE', 'fi_FI'); setlocale ('LC_TIME', 'fi_FI'); define('DATE_FORM_HELPER_FORMAT_HOUR','24'); define('DATE_APP_DATE_PICKER', 'dd-mm-yy'); define('DATE_APP_GENERIC_MDYT_FULL', 'j. F Y - G:i'); define('DATE_APP_GENERIC_MDYT', 'j-n-Y - G:i'); define('DATE_APP_GENERIC_MDY', 'j-n-Y'); define('DATE_APP_GENERIC_MDY_FULL', 'j. F Y'); define('DATE_APP_DATE_ATTRIBUTE_TYPE_T', 'G:i:s');
Viewing 15 lines of 17 lines. View entire code block.
Here is my view.php code:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $textHelper = Loader::helper("text"); $BASE_URL = BASE_URL; $blogify = Loader::helper('blogify','problog'); $searchID = $blogify->getBlogSettings(); $searchn= Page::getByID($searchID['search_path']); $search= $nh->getLinkToCollection($searchn); if($title!=''){ echo '<h1>'.t($title).'</h1>'; } if (count($cArray) > 0) { ?> <div class="ccm-page-list"> <?php for ($i = 0; $i < count($cArray); $i++ ) {
Viewing 15 lines of 47 lines. View entire code block.
// Mika
Thx for your answer..again.. it is so cool that somebody is trying to help...!!
Thing is that page where that month is located is archive kind of page so there will be
more months in that list than just "Septemper"..in the future..
this is the page ->http://testi6.aada.fi/paakirjoitus/2014/...
how would you code in this situation?
// Mika
Thing is that page where that month is located is archive kind of page so there will be
more months in that list than just "Septemper"..in the future..
this is the page ->http://testi6.aada.fi/paakirjoitus/2014/...
how would you code in this situation?
// Mika
So you would put that line into this line somehow?
>> echo '<a onClick="$(\'#month_'.$month.$year.'\').toggle(\'fast\')" style="cursor: pointer;">'.date('F',strtotime($year.'-'.$month.'-1')).'</a><br/>';
/ Mika
>> echo '<a onClick="$(\'#month_'.$month.$year.'\').toggle(\'fast\')" style="cursor: pointer;">'.date('F',strtotime($year.'-'.$month.'-1')).'</a><br/>';
/ Mika
My view.php looks like this:
Now the month list is like this when it should be in finnish???
- January
- January
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $textHelper = Loader::helper("text"); $BASE_URL = BASE_URL; $blogify = Loader::helper('blogify','problog'); $searchID = $blogify->getBlogSettings(); $searchn= Page::getByID($searchID['search_path']); $search= $nh->getLinkToCollection($searchn); $dh = Loader::helper('date'); if($title!=''){ echo '<h1>'.t($title).'</h1>'; } if (count($cArray) > 0) { ?> <div class="ccm-page-list"> <?php
Viewing 15 lines of 48 lines. View entire code block.
Now the month list is like this when it should be in finnish???
- January
- January
As I told you, you have to use the date method of the DateTime helper instead of the date function.
Replace
with
Replace
date(...)
with
$dh->date(...)
Many server instances don't have set locale configured, so it's not safe to rely on it.
It's far better to use the concrete5 DateHelper
It's far better to use the concrete5 DateHelper
so then that should be the following for this block:
C
<?php echo $dh->date('F', $workingDt->getTimestamp() ); ?>
C
Hi C,
how can i translate labels in problog form?
/ Mika
how can i translate labels in problog form?
/ Mika
Hi mlocati,
thx for your help.
This line works perfectly but only thing is that in finnish language we have in fi.xml
more parameters for months than in english.
Now i got the right months in list :
- Syyskuuta
- Lokakuuta
but i want to take that 'TA' out of months name. How do i do this?
p.s
e.g SYYSKUUTA (means 'of september') when just SYYSKUU means ('september').
// Mika
thx for your help.
echo '<a onClick="$(\'#month_'.$month.$year.'\').toggle(\'fast\')" style="cursor: pointer;">'.$dh->date('F',strtotime($year.'-'.$month.'-1')).'</a><br/>';
This line works perfectly but only thing is that in finnish language we have in fi.xml
more parameters for months than in english.
Now i got the right months in list :
- Syyskuuta
- Lokakuuta
but i want to take that 'TA' out of months name. How do i do this?
p.s
e.g SYYSKUUTA (means 'of september') when just SYYSKUU means ('september').
// Mika
Aha! Interesting!
In this case you can't use the DateHelper, but you have to access the underlying library that we use to translate dates.
You first need to retrieve the the month names:
Then you can use this new $monthNames variable. In your example you should write:
In this case you can't use the DateHelper, but you have to access the underlying library that we use to translate dates.
You first need to retrieve the the month names:
Loader::library('3rdparty/Zend/Locale'); $monthNames = Zend_Locale::getTranslationList('month', Localization::activeLocale(), array('gregorian', 'stand-alone', 'wide')); if($monthNames[1] === '1') { $monthNames = Zend_Locale::getTranslationList('month', Localization::activeLocale(), array('gregorian', 'format', 'wide')); }
Then you can use this new $monthNames variable. In your example you should write:
echo '<a onClick="$(\'#month_'.$month.$year.'\').toggle(\'fast\')" style="cursor: pointer;">'.$monthNames[$month].'</a><br/>';
:-)
very interesting..finnish language is...
I tried with this code but then my list just disappears :-)
Is the Loader::Library.. in the right place at all?
very interesting..finnish language is...
I tried with this code but then my list just disappears :-)
Is the Loader::Library.. in the right place at all?
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $textHelper = Loader::helper("text"); $BASE_URL = BASE_URL; $blogify = Loader::helper('blogify','problog'); $searchID = $blogify->getBlogSettings(); $searchn= Page::getByID($searchID['search_path']); $search= $nh->getLinkToCollection($searchn); $dh = Loader::helper('date'); Loader::library('3rdparty/Zend/Locale'); $monthNames = Zend_Locale::getTranslationList('month', Localization::activeLocale(), array('gregorian', 'stand-alone', 'wide')); if($monthNames[1] === '1') { $monthNames = Zend_Locale::getTranslationList('month', Localization::activeLocale(), array('gregorian', 'format', 'wide')); } if($title!=''){
Viewing 15 lines of 53 lines. View entire code block.
You should check the PHP error log
wow! interesting!
how i do that?
/ M
how i do that?
/ M
Is the whole page blank? Or you just stopped seeing the month names?
In the second case, you could try to see the value of $monthNames, by placing something like the following after the definition of $monthNames:
In the second case, you could try to see the value of $monthNames, by placing something like the following after the definition of $monthNames:
var_dump($monthNames);
Hi,
thz for your help again.
My code:
gives me list of all finnish months...but right way as i would like them to be on list.
What is the right place for your (var_dump($monthNames);) code??
// Mika
thz for your help again.
My code:
echo '<a onClick="$(\'#month_'.$month.$year.'\').toggle(\'fast\')" style="cursor: pointer;">'.var_dump($monthNames);$monthNames[$month].'</a><br/>';
gives me list of all finnish months...but right way as i would like them to be on list.
What is the right place for your (var_dump($monthNames);) code??
// Mika
I suggested you to add that var_dump only to see if it contains the correct values.
Since $monthNames seems correct, we have to look for the problem in another place.
You could try this code:
Since $monthNames seems correct, we have to look for the problem in another place.
You could try this code:
echo '<a onClick="$(\'#month_'.$month.$year.'\').toggle(\'fast\')" style="cursor: pointer;">'.$monthNames[intval($month)].'</a><br/>';
Hi,
thx for so much for your patient and help!!!!
It finally works!!!
// Mika
thx for so much for your patient and help!!!!
It finally works!!!
// Mika
hi,
i do not get any error msg on my page even i have "Show Errors in Page" checked on
Dashboard > System & Settings > Environment > Debug Settings
// Mika
i do not get any error msg on my page even i have "Show Errors in Page" checked on
Dashboard > System & Settings > Environment > Debug Settings
// Mika