Răsfoiți Sursa

lang option no longer case sensitive

Morten Brix Pedersen 24 ani în urmă
părinte
comite
cd27efc81f
2 a modificat fișierele cu 5 adăugiri și 5 ștergeri
  1. 3 3
      modules/Pisg.pm
  2. 2 2
      modules/Pisg/HTMLGenerator.pm

+ 3 - 3
modules/Pisg.pm

@@ -97,7 +97,7 @@ sub get_default_config_settings
         imagepath => '',
         imagepath => '',
         default_pic => '',
         default_pic => '',
         logdir => '',
         logdir => '',
-        lang => 'EN',
+        lang => 'en',
         langfile => 'lang.txt',
         langfile => 'lang.txt',
         prefix => '',
         prefix => '',
         silent => 0,
         silent => 0,
@@ -207,9 +207,9 @@ sub get_language_templates
     {
     {
         next if ($line =~ /^#/);
         next if ($line =~ /^#/);
 
 
-        if ($line =~ /<lang name=\"([^"]+)\">/) {
+        if ($line =~ /<lang name=\"([^"]+)\">/i) {
             # Found start tag, setting the current language
             # Found start tag, setting the current language
-            my $current_lang = $1;
+            my $current_lang = lc($1);
 
 
             while (<FILE>) {
             while (<FILE>) {
                 last if ($_ =~ /<\/lang>/i);
                 last if ($_ =~ /<\/lang>/i);

+ 2 - 2
modules/Pisg/HTMLGenerator.pm

@@ -1367,10 +1367,10 @@ sub _template_text
 
 
     my $text;
     my $text;
 
 
-    unless ($text = $self->{tmps}->{$self->{cfg}->{lang}}{$template}) {
+    unless ($text = $self->{tmps}->{lc($self->{cfg}->{lang})}{$template}) {
         # Fall back to English if the language template doesn't exist
         # Fall back to English if the language template doesn't exist
 
 
-        if ($text = $self->{tmps}->{EN}{$template}) {
+        if ($text = $self->{tmps}->{en}{$template}) {
             print "Note: No translation in '$self->{cfg}->{lang}' for '$template' - falling back to English..\n"
             print "Note: No translation in '$self->{cfg}->{lang}' for '$template' - falling back to English..\n"
                 unless ($self->{cfg}->{silent});
                 unless ($self->{cfg}->{silent});
         } else {
         } else {