Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) "downloads" can be translated two ways (Read 4039 times)
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: "downloads" can be translated two ways
Reply #10 - Aug 31st, 2014 at 10:35am
Print Post  
Using the new isempty():

Code
Select All
Index: cgi-bin/yabb2/Sources/Display.pm
===================================================================
--- cgi-bin/yabb2/Sources/Display.pm	(revision 1557)
+++ cgi-bin/yabb2/Sources/Display.pm	(working copy)
@@ -870,7 +870,7 @@
                 my $filesize = -s "$uploaddir/$_";
                 $urlname = $_;
                 $urlname =~ s/([^A-Za-z0-9])/sprintf('%%%02X', ord($1))/egxsm;
-                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41a'};
+                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : isempty( $fatxt{'41c'}, $fatxt{'41a'} );
                 if ($filesize) {
                     if (   $_ =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ixsm
                         && $amdisplaypics == 1 )
Index: cgi-bin/yabb2/Sources/Printpage.pm
===================================================================
--- cgi-bin/yabb2/Sources/Printpage.pm	(revision 1557)
+++ cgi-bin/yabb2/Sources/Printpage.pm	(working copy)
@@ -676,7 +676,7 @@
                       : "$micon_bg{'paperclip'}";
                 }
                 my $filesize = -s "$uploaddir/$_";
-                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41a'};
+                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : isempty( $fatxt{'41c'}, $fatxt{'41a'} );
                 if ($filesize) {
                     if (   $_ =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ixsm
                         && $amdisplaypics == 1 )
 

  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: "downloads" can be translated two ways
Reply #9 - Jul 20th, 2014 at 7:17pm
Print Post  
Monni wrote on Jul 20th, 2014 at 5:58pm:
Since then I have been working on internationalization projects...


Keep up the good work.  Smiley
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: "downloads" can be translated two ways
Reply #8 - Jul 20th, 2014 at 5:58pm
Print Post  
Dandello wrote on Jul 20th, 2014 at 5:49pm:
YaBB has the distinction of being one of the first Perl software forum packages (if not THE first Perl software forum package) that uses a framework. (Which outputs html and javascript. And one of the issues JonB has been having in getting the BoardMod.org code to work is that IT was outputting some sections to PHP.)


The first Perl code ever I was working on was SMB2WWW... For some weird reason I decided I wanted it to be internationalized Smiley Since then I have been working on internationalization projects...
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: "downloads" can be translated two ways
Reply #7 - Jul 20th, 2014 at 5:49pm
Print Post  
YaBB has the distinction of being one of the first Perl software forum packages (if not THE first Perl software forum package) that uses a framework. (Which outputs html and javascript. And one of the issues JonB has been having in getting the BoardMod.org code to work is that IT was outputting some sections to PHP.)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: "downloads" can be translated two ways
Reply #6 - Jul 20th, 2014 at 5:30pm
Print Post  
Dandello wrote on Jul 20th, 2014 at 5:19pm:
Monni wrote on Jul 20th, 2014 at 4:53pm:
I'm not a coder, I'm a hacker... That's a difference... 
                   


This is Perl - we're all hackers.  Grin


lol... the forum logged me out in middle of reply...

Eh... I thought this was Perl code that outputs JavaScript and html... Just like I used to also write TCL code that did output PHP code that did output... eh...
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: "downloads" can be translated two ways
Reply #5 - Jul 20th, 2014 at 5:19pm
Print Post  
Monni wrote on Jul 20th, 2014 at 4:53pm:
I'm not a coder, I'm a hacker... That's a difference... 
                   


This is Perl - we're all hackers.  Grin
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: "downloads" can be translated two ways
Reply #4 - Jul 20th, 2014 at 4:53pm
Print Post  
Dandello wrote on Jul 20th, 2014 at 3:01pm:
This is why it's good to have more than one coder onboard. Grin

I'm not a coder, I'm a hacker... That's a difference...
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: "downloads" can be translated two ways
Reply #3 - Jul 20th, 2014 at 3:01pm
Print Post  
This is why it's good to have more than one coder onboard. Grin
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: "downloads" can be translated two ways
Reply #2 - Jul 20th, 2014 at 1:59pm
Print Post  
Dandello wrote on Jul 20th, 2014 at 1:55pm:
If we make it (as a mod in this case)

Code (Perl)
Select All
if ($fatxt{'41c'}) {$fatxt{'41a'} = $fatxt{'41c'};}
$download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41a'}; 



That way other languages that don't need it won't be affected.


Overwriting variables at run-time is something I try to avoid... Can cause weird bugs that are hard to trace...

Instead you should try something like this:

Code
Select All
$download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : (($fatxt{'41c'}) ? $fatxt{'41c'} : $fatxt{'41a'});
 

  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: "downloads" can be translated two ways
Reply #1 - Jul 20th, 2014 at 1:55pm
Print Post  
If we make it (as a mod in this case)

Code (Perl)
Select All
if ($fatxt{'41c'}) {$fatxt{'41a'} = $fatxt{'41c'};}
$download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41a'}; 



That way other languages that don't need it won't be affected.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
"downloads" can be translated two ways
Jul 20th, 2014 at 12:50pm
Print Post  
Code
Select All
Index: cgi-bin/yabb2/Languages/English/FA.lng
===================================================================
--- cgi-bin/yabb2/Languages/English/FA.lng	(revision 1513)
+++ cgi-bin/yabb2/Languages/English/FA.lng	(working copy)
@@ -89,6 +89,7 @@
 '41' => 'File Size',
 '41a' => 'Downloads',
 '41b' => 'Download',
+'41c' => 'Downloads', # n downloads
 '42' => 'Posted By',
 '42a' => 'Attached By',
 '43' => 'Date',
Index: cgi-bin/yabb2/Sources/Display.pm
===================================================================
--- cgi-bin/yabb2/Sources/Display.pm	(revision 1513)
+++ cgi-bin/yabb2/Sources/Display.pm	(working copy)
@@ -870,7 +870,7 @@
                 my $filesize = -s "$uploaddir/$_";
                 $urlname = $_;
                 $urlname =~ s/([^A-Za-z0-9])/sprintf('%%%02X', ord($1))/egxsm;
-                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41a'};
+                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41c'};
                 if ($filesize) {
                     if (   $_ =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ixsm
                         && $amdisplaypics == 1 )
Index: cgi-bin/yabb2/Sources/Printpage.pm
===================================================================
--- cgi-bin/yabb2/Sources/Printpage.pm	(revision 1513)
+++ cgi-bin/yabb2/Sources/Printpage.pm	(working copy)
@@ -676,7 +676,7 @@
                       : "$micon_bg{'paperclip'}";
                 }
                 my $filesize = -s "$uploaddir/$_";
-                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41a'};
+                $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : $fatxt{'41c'};
                 if ($filesize) {
                     if (   $_ =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ixsm
                         && $amdisplaypics == 1 )
 

  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint