Msgcat.pm: return untranslated strings properly when no translation is found
authorlevinse <levinse>
Tue, 14 Jun 2011 18:53:40 +0000 (18:53 +0000)
committerlevinse <levinse>
Tue, 14 Jun 2011 18:53:40 +0000 (18:53 +0000)
FS/FS/Msgcat.pm

index 2429805..2406e8d 100644 (file)
@@ -58,6 +58,8 @@ our %cache;
 
 sub _gettext {
   my $msgcode = shift;
+  return '' unless defined($msgcode) && length($msgcode) > 0;
+
   my $locale =  (@_ && shift)
              || $FS::CurrentUser::CurrentUser->option('locale')
              || $def_locale;
@@ -85,6 +87,7 @@ sub _gettext {
                                        });
         warn "WARNING: auto-inserting message for msgcode $msgcode in locale $locale";
         $newmsgcat->insert;
+        return $msgcode; # or maybe this should be below the next bracket?
     }
   }