The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Translation script

View previous topic View next topic Go down

Solved Translation script

Post by Guest on November 7th 2014, 9:45 am

Could I have a script for PunBB like the one given in the link? o.o
http://help.forumotion.com/t134243-how-to-change-these-signs-in-another-language

I want to translate these:


Thanks.


Last edited by Fédra on November 11th 2014, 7:58 am; edited 1 time in total

Guest
Guest


Back to top Go down

Solved Re: Translation script

Post by Ange Tuteur on November 8th 2014, 8:06 am

Hello Fédra,

Give this a try :
Code:
$(function() {
  var last24 = 'Members connected during last 24 hours : ',
      nobday = 'No users have a birthday today',
      bdaytoday = 'Users having a birthday today',
      nobdaynext7 = 'No users are having a birthday in the upcoming 7 days',
      bdaynext7 = 'Users with a birthday within the next 7 days:',
      legend = 'Legend :',
      inchat = 'There are currently 0 user(s) on the ChatBox :',
  who = document.getElementById('pun-info');
  who.innerHTML = who.innerHTML.replace('Members connected during last 24 hours :',last24).replace('No users have a birthday today',nobday).replace('Users having a birthday today',bdaytoday).replace('Users with a birthday within the next 7 days: ',bdaynext7).replace('No users are having a birthday in the upcoming 7 days',nobdaynext7).replace('Legend&nbsp;:&nbsp;',legend).replace(/There are currently (<strong>\d+<\/strong>) user\(s\) on the ChatBox&nbsp;:&nbsp;/,inchat);
});

If there's more that you want to translate, let me know and I'll add the variables. Wink

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Translation script

Post by Guest on November 8th 2014, 9:35 am

Hai Ange Tuteur!  Mr. Green
Thank you, but unfortunately, it doesn't work. 

Guest
Guest


Back to top Go down

Solved Re: Translation script

Post by SLGray on November 8th 2014, 10:46 am

Did you activate JavaScript Management?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35629
Reputation : 2372
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Translation script

Post by Guest on November 8th 2014, 12:57 pm

Yes, and it's like this. 

(Actually, if I use the full code, the birthday message is translated, but I don't even want it to show up. Very Happy The rest would be more important to be translated.) 

Guest
Guest


Back to top Go down

Solved Re: Translation script

Post by Ange Tuteur on November 8th 2014, 9:22 pm

Here try now :
Code:
$(function() {
  var last24 = 'Members connected during last 24 hours : ',
      nobday = 'No users have a birthday today',
      bdaytoday = 'Users having a birthday today',
      nobdaynext7 = 'No users are having a birthday in the upcoming 7 days',
      bdaynext7 = 'Users with a birthday within the next 7 days:',
      legend = 'Legend :',
      inchat = 'There are currently 0 user(s) on the ChatBox :',
  who = document.getElementById('pun-info');
  who.innerHTML = who.innerHTML.replace('Members connected during last \d+ hours :',last24).replace('No users have a birthday today',nobday).replace('Users having a birthday today',bdaytoday).replace('Users with a birthday within the next \d+ days: ',bdaynext7).replace('No users are having a birthday in the upcoming \d+ days',nobdaynext7).replace('Legend&nbsp;:&nbsp;',legend).replace(/There are currently (<strong>\d+<\/strong>) user\(s\) on the ChatBox&nbsp;:&nbsp;/,inchat);
});

I forgot to replace the number with a digit metacharacter.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Translation script

Post by Guest on November 9th 2014, 10:00 am

I forgot to replace the number with a digit metacharacter.
I wish to understand this one day! Mr. Green


Thank you so much Ange, but it's still not working. I think it's not your fault, it must be me who messed up something somewhere. :'D I'll try to find it, thanks for the codes! I'm sure they'll be good!~~


Edit: oh yea, setting the language at the Profile settings can make wonders. :'D Almost perfect.

Guest
Guest


Back to top Go down

Solved Re: Translation script

Post by Ange Tuteur on November 9th 2014, 10:59 pm

Super Very Happy

Which translations do not work for you, and could you share the script with the translation made ? I can check to see if it's a problem with the regular expression, if you want. Smile

P.S.
The digit metacharacter is a special character used to match a digit : \d
\d will match the numbers 0,1,2,3,4,5,6,7,8, and 9 in a regular expression

adding a + will match whole numbers like 90, 100, 1000 : \d+

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Translation script

Post by Guest on November 10th 2014, 12:13 pm

Members connected during last 24 hours doesn't work. Lol  And the birthday one, but I'll remove that part anyway, so it's not important. :'D

The script looks like this now
Code:
$(function() {
  var last24 = '24 órája itt volt : ',
      nobday = 'Senkinek nincs ma a szülinapja',
      bdaytoday = 'Neki(k) van a szülinapja ma: ',
      nobdaynext7 = 'Senkinek nincs szülinapja az elkövetkezendő 7 napban',
      bdaynext7 = '7 napon belül ünnepli a szülinapját: :',
      legend = 'Csoportok:',
      inchat = 'Jelenleg senki nem chatel:',
  who = document.getElementById('pun-info');
  who.innerHTML = who.innerHTML.replace('Members connected during last \d+ hours :',last24).replace('No users have a birthday today',nobday).replace('Users having a birthday today',bdaytoday).replace('Users with a birthday within the next \d+ days: ',bdaynext7).replace('No users are having a birthday in the upcoming \d+ days',nobdaynext7).replace('Legend&nbsp;:&nbsp;',legend).replace(/There are currently (<strong>\d+<\/strong>) user\(s\) on the ChatBox&nbsp;:&nbsp;/,inchat);
});


P.S.
Thank you very much for the explanation! Mr. Green

Guest
Guest


Back to top Go down

Solved Re: Translation script

Post by Ange Tuteur on November 11th 2014, 12:48 am

Here try now :
Code:
$(function() {
  var last24 = '24 órája itt volt : ',
      nobday = 'Senkinek nincs ma a szülinapja',
      bdaytoday = 'Neki(k) van a szülinapja ma: ',
      nobdaynext7 = 'Senkinek nincs szülinapja az elkövetkezendő 7 napban',
      bdaynext7 = '7 napon belül ünnepli a szülinapját: :',
      legend = 'Csoportok:',
      inchat = 'Jelenleg senki nem chatel:',
  who = document.getElementById('pun-info');
  who.innerHTML = who.innerHTML.replace(/Members connected during last \d+ hours : /,last24).replace(/No users have a birthday today/,nobday).replace(/Users having a birthday today/,bdaytoday).replace(/Users with a birthday within the next \d+ days: /,bdaynext7).replace(/No users are having a birthday in the upcoming \d+ days/,nobdaynext7).replace(/Legend&nbsp;:&nbsp;/,legend).replace(/There are currently (<strong>\d+<\/strong>) user\(s\) on the ChatBox&nbsp;:&nbsp;/,inchat);
});

I made a mistake by using a string instead of a regular expression.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Translation script

Post by Guest on November 11th 2014, 7:56 am

You're AMAZING! Thank you!!! Mr. Green
Solved.~~

Guest
Guest


Back to top Go down

Solved Re: Translation script

Post by Ange Tuteur on November 11th 2014, 9:32 am

You're welcome

Topic archived

Have a nice day. Smile

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum