Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Translations    Topic: How to translate digits or numbers in comments ?
Pages: [1] 2   Go Down
  Print  
Author Topic: How to translate digits or numbers in comments ?  (Read 7432 times)
0 Members and 1 Guest are viewing this topic.
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« on: September 27, 2010, 23:35:16 »

Hi,

I liked your comment system. Thank you for that.

Can you tell me please how to translate numbers/digits for example in dates, counters, etc in other language ( my language is Bengali).

Waiting eagerly for the reply.

Thanks in advance.
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: September 27, 2010, 23:54:16 »

All language strings (and dates format) could be localized through component's language file. Copy file /language/en-GB/en-GB.com_jcomments.ini to /language/bn-BD/bn-BD.com_jcomments.ini and translate it.

p.s I'm not sure but seems 'bn-BD' is a correct code for Bengali.

Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« Reply #2 on: September 28, 2010, 00:10:04 »

Hi,

Thanks for your reply.

Yes you are correct. The language file bn-BD is a bengali one and I have translated the file /language/bn-BD/bn-BD.com_jcomments.ini

But the problem is I cannot translate the digits/numbers. I am successful in translating texts and sentences but not numbers. and digits.

If you give me some examples how to translate numbers, that will be very helpful. I have tried with
1=১
2=২
3= ৩
.....
...

but that does not work Sad  I need to translate dates and comment numbers.

Thanks
« Last Edit: September 28, 2010, 00:12:52 by dancingbuddha » Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #3 on: September 28, 2010, 00:24:50 »

Hm... I've never had such task as digits translation. But seems we could do this.

1. Open file /components/com_jcomments/tpl/default/tpl_links.php
2. Find code:
Code: (php)
$text = JText::sprintf('Read comments', $count);
and replace it with:
Code: (php)
$digits = strval($count);
$translatedCounter = '';
for($i=0,$n=strlen($digits);$i<$n;$i++) {
$translatedCounter .= JText::_($digits[$i]);
}
$text = JText::sprintf('Read comments', $translatedCounter);

After this you'll need insert in your language file constants like you've described:
1=A
2=B
...

Regarding date format...  I don't know. In my mind you need to refer the strftime[/b] function documentation.
« Last Edit: September 28, 2010, 15:21:22 by smart » Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« Reply #4 on: September 28, 2010, 09:26:18 »

Thank you for your help.

I am sorry to say that this piece of code had no effects Sad Following is an example.


              #1 টেস্ট 2010-09-27 05:32
              এই মন্তব্যটি পরিক্ষামুলক


I appreciate your help.
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #5 on: September 28, 2010, 13:05:19 »

This piece of code should replace digits in blog (comments counter). If you need to translate comments numbers in comments list you need edit file: /components/com_jcomments/tpl/default/tpl_comment.php and replace code:

Code: (php)
$comment_number = $this->getVar('comment-number', 1);
with
Code: (php)
$comment_number = $this->getVar('comment-number', 1);
$digits = strval($comment_number);
$translatedCounter = '';
for($i=0,$n=strlen($digits);$i<$n;$i++) {
$translatedCounter .= JText::_($digits[$i]);
}
$comment_number = $translatedCounter;
« Last Edit: September 28, 2010, 15:21:10 by smart » Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« Reply #6 on: September 28, 2010, 14:54:26 »

 Cheesy

I am sorry but after implementing as said the whole page become a full white one with no text no image nothing at all  Cry

I should have fixed the issue on your tips but I do not know php ...

Please put some more effort on behalf of me Smiley

thanks
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #7 on: September 28, 2010, 15:22:06 »

Oh, sorry. I've made a mistake. I've already updated both code blocks in previous messages.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« Reply #8 on: September 28, 2010, 17:13:12 »

"Oh, sorry. I've made a mistake. I've already updated both code blocks in previous messages."

I am sorry as I did not understand. Would you mind helping me understand please. As I said I do not understand PhP so you need to tell me in layman's term  Sad

Can you put again the final piece of code please...

Thank you.
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #9 on: September 28, 2010, 18:59:15 »

Can you put again the final piece of code please...
See my previous messages - I've corrected them and now they contain correct code.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« Reply #10 on: September 28, 2010, 19:43:51 »

Excellent !!  Smiley It is working almost perfectly now.

Now one small problem appeared.. The counting is starting from 2 instead of 1 ....

Thanks in advance Smiley
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #11 on: September 28, 2010, 19:51:10 »

Now one small problem appeared.. The counting is starting from 2 instead of 1 ....
It sounds like you've mistaken in language file. Because I've tested these changes with language file:

Code:
1=A
2=B
3=C

And script outputs ABC instead 123. So it works fine for me.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« Reply #12 on: September 28, 2010, 20:08:38 »

Hi,

Thanks a lot. You really owe a treat from me.

I have checked the language file. The translation is correct there. Anyway, I blindly tried one change that worked  Shocked

and that is


            $digits = strval($comment_number-1);
instead of


            $digits = strval($comment_number);
 Roll Eyes

But Thank you once again for your great help  Smiley

I will surely rate 5 star this extension now on the Joomla site  Smiley

My request, please make some options to change the language of DATE and TIME too.

Take care.
« Last Edit: September 28, 2010, 20:10:50 by dancingbuddha » Logged
dancingbuddha
Newbie
*

Karma: 0
Offline Offline

Posts: 12


« Reply #13 on: September 28, 2010, 22:35:18 »

As I mentioned in my previous message how the issue of starting index from 2 was solved probably is in conflict with comment voting (Good comment , bad comment) as in the first comment the comment voting buttons are not there  Cry
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #14 on: September 28, 2010, 23:41:53 »

I will surely rate 5 star this extension now on the Joomla site  Smiley
Thank you!

My request, please make some options to change the language of DATE and TIME too.
In my mind you could solve this using appropriate date format for your locale.

as in the first comment the comment voting buttons are not there  Cry
Search through forum - I've described more than one time why voting buttons could be hidden. This isn't bug. All ok.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1] 2   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Translations    Topic: How to translate digits or numbers in comments ?
 
Jump to: