TinyPortal

Development => Support => Topic started by: fak3 on May 03, 2009, 01:25:19 AM

Title: Howto translate date
Post by: fak3 on May 03, 2009, 01:25:19 AM
Hi,
I noticed that even if a tp translation is installed, the names of the months in frontpage remain in english.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg12.imageshack.us%2Fimg12%2F4535%2Ftraduzione.th.jpg&hash=f8387762c2f72ac7ec54ae6065a8a6c4b48a6bc6) (http://img12.imageshack.us/my.php?image=traduzione.jpg)

How can I translate them?
For example, "May 03  2009" should be "Mag 03  2009".

Thank you in advance. :)
I'm using SMF 1.1.8 with the last TP beta.
Title: Re: Howto translate date
Post by: G6Cad on May 03, 2009, 08:56:36 AM
That should be translated from the SMF files, TP just import the text from the SMF, so you have to check so the SMF language files you have are translated correctly.
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 11:18:18 AM
What's wrong with my translation? ???
Code (/Themes/default/languages/index.italian-utf8.php) Select
$txt['months'] = array(1 => 'Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre');
$txt['months_titles'] = array(1 => 'Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre');
$txt['months_short'] = array(1 => 'Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic');

Inside the forum the names of the months/days are translated... maybe it's a TP problem. Even if I change months names in index.english.php they remain in english. :idiot2:
Title: Re: Howto translate date
Post by: G6Cad on May 03, 2009, 11:31:29 AM
I see you have utf8, did you add the utf8 language package for TP aswell ?
And does your forum run on utf8 ?  Check in your Admin/configuration/Server Settings
What language is set there ? is it utf8 ?
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 11:37:52 AM
Yep, it's running utf-8.
Title: Re: Howto translate date
Post by: G6Cad on May 03, 2009, 11:42:12 AM
And then, did you add the utf8 language package for tp for your language aswell ?
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 11:46:45 AM
Sure...
Title: Re: Howto translate date
Post by: G6Cad on May 03, 2009, 11:47:51 AM
Then im clueless  :-\
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 11:53:02 AM
Maybe a little TP bug? :o
I asked in the italian support section (http://www.tinyportal.net/index.php/topic,29451.0.html) and others seem to have the same problem...
Title: Re: Howto translate date
Post by: ZarPrime on May 03, 2009, 11:57:31 AM
Hmmm, is this problem only on a post that is set to show on the Front Page?  Can I see your site please where you see this?  Link?

ZarPrime
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 12:01:11 PM
http://www.mysammy.it I don't know if it's only with posts in frontpage, I don't use articles.
Title: Re: Howto translate date
Post by: bbTURK on May 03, 2009, 12:15:14 PM
i think that tp uses php date functions. i could not find date string in tp source and lang files.
Title: Re: Howto translate date
Post by: ZarPrime on May 03, 2009, 12:15:55 PM
OK, I just wanted to see if the date was shown properly in your posts inside the Forum.  OK, can you attach your Italian Language files to your next post here so that I can look at them.  There are 7 files I want to look at (TP*.italian-utf8.php) where the asterisk is different for each file.  Please put all 7 files into a zip file and attach it here.

ZarPrime
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 12:21:07 PM
It's the translation I downloaded from tinyportal.co.uk. Btw thanks for the help. :)
Title: Re: Howto translate date
Post by: ZarPrime on May 03, 2009, 12:28:34 PM
OK, give me a little time to look at these as I'm doing 14 things at once.  :idiot2:

NP on the help.  That's what we're here for.  I'll be back in a little bit.

ZP
Title: Re: Howto translate date
Post by: Dark-Wolf on May 03, 2009, 12:51:17 PM
Hi!
I have same problem and i think is in this code part (TPortal.template.php):
$ntime='
<span class="tp_month">' . date("M",$story['timestamp']). '</span><span class="tp_thindivider">  </span><span class="tp_day">'. date("d",$story['timestamp']) . '</span> <span class="tp_year"> '. date("Y",$story['timestamp']) . '</span>';
but i don't have found any way to fix :)
Title: Re: Howto translate date
Post by: ZarPrime on May 03, 2009, 01:06:39 PM
OK, well, I've checked the language files and they appear to be right, or at least very close what the ones we have in the download section are (only a few small differences), so there is something else going on here.  Dark Wolf, you may be right but I think I'm going to have to have Mr. Bloc take a look at this.

I have a theory.  It may have something to do with an issue I brought up on the team board last week regarding shortened dates.  Since Bloc will have to look, it's going to take me a while to see if this can be sorted out or whether it might be a bug.  Bear with me for awhile, like more than a couple of days but hopefully less than a week.  :)

ZarPrime
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 01:34:46 PM
Ok ZarPrime, thank you. :)
Title: Re: Howto translate date
Post by: ZarPrime on May 03, 2009, 03:24:51 PM
fak,

OK, Bloc is looking at this and he immediately thought he knew what it was.  You won't be able to read the message but according to him ...

Quote from: Bloc on May 03, 2009, 03:06:34 PM
I know what this is..the date function needs "setlocale" to be set, to get the correct language.I'll add and test asap.

I'll get back to this as soon as he finishes looking at it to see if it's an easy fix or whether you'll have to wait for the next beta.

ZarPrime
Title: Re: Howto translate date
Post by: fak3 on May 03, 2009, 05:07:20 PM
Nice one ZP n co!
Title: Re: Howto translate date
Post by: Ianedres on May 04, 2009, 03:38:25 AM
I was looking at this also and thought it may be a regional setting for your server's php configuration...

See this: http://www.php.net/manual/en/function.setlocale.php

Follow a few of the examples (under the changelog) to check what your server is returning...
Title: Re: Howto translate date
Post by: fak3 on May 04, 2009, 11:14:27 AM
Hey Ianedres. :)

Example 1:
<?php
/* Set locale to Dutch */
setlocale(LC_ALL'nl_NL');

/* Output: vrijdag 22 december 1978 */
echo strftime("%A %e %B %Y"mktime(00012221978));

/* try different possible locale names for german as of PHP 4.3.0 */
$loc_de setlocale(LC_ALL'de_DE@euro''de_DE''de''ge');
echo 
"Preferred locale for german on this system is '$loc_de'";
?>


Returned:
vrijdag 22 december 1978Preferred locale for german on this system is 'de_DE@euro'

Example 2:
<?php
/* Set locale to Dutch */
setlocale(LC_ALL'nld_nld');

/* Output: vrijdag 22 december 1978 */
echo strftime("%A %d %B %Y"mktime(00012221978));

/* try different possible locale names for german as of PHP 4.3.0 */
$loc_de setlocale(LC_ALL'de_DE@euro''de_DE''deu_deu');
echo 
"Preferred locale for german on this system is '$loc_de'";
?>


Returned:
Friday 22 December 1978Preferred locale for german on this system is 'de_DE@euro'

I don't know what they mean. :buck2:
Title: Re: Howto translate date
Post by: Ianedres on May 04, 2009, 05:36:44 PM
This sets the language to Italian on my United States server.
setlocale(LC_ALL, 'it_IT.ISO8859-1', 'it_IT.UTF-8');

By combining it with this next line, it outputs the date in Italian properly.
echo strftime("%A, %d %B %Y") . "\n";


Not sure where to place the setlocale in the TP scripts...  Bloc? 
Title: Re: Howto translate date
Post by: ZarPrime on May 04, 2009, 08:12:51 PM
fak3,

OK, per Bloc's request, and so that I don't have to keep watching this topic, I have posted this issue on the bugtracker.  The link to the bug is here --> http://www.tinyportal.net/index.php?action=bugtracker;sa=bug498

If you are interested, I suggest you check the bugtracker once in a while to check on the status of this.  Bloc will get to it and sort it out as soon as he can.

ZarPrime
Title: Re: Howto translate date
Post by: fak3 on May 04, 2009, 09:00:31 PM
Ok, I'll keep checking the bugtracker. ;) Thank you for the help.
Title: Re: Howto translate date
Post by: G6Cad on May 05, 2009, 11:32:26 AM
http://www.tinyportal.net/index.php?action=bugtracker;sa=bug498

You have a fix there now.
Title: Re: Howto translate date
Post by: Dark-Wolf on May 05, 2009, 11:59:47 AM
@G6: thanks for your fix.
Edit:
but is TPortal.template.php and not TPBlocks.template.php ;)
Title: Re: Howto translate date
Post by: G6Cad on May 05, 2009, 12:24:19 PM
Wasent me that fixed it, was our Bloc :)

And it's not always the obvious file the fixes are, this is one of those times  ;)