- fix error with referencing translations file
authorAndreas Scherbaum <andreas@scherbaum.biz>
Fri, 24 Aug 2012 17:56:21 +0000 (19:56 +0200)
committerAndreas Scherbaum <andreas@scherbaum.biz>
Fri, 24 Aug 2012 17:56:21 +0000 (19:56 +0200)
docbot.pl

index 3aa61493341992574eca50ef6964b3e08de5f780..197357f4d48f071cf9c5040fb09d33195135d130 100755 (executable)
--- a/docbot.pl
+++ b/docbot.pl
@@ -1384,6 +1384,11 @@ sub translate {
     my $language = shift;
     my $word     = shift;
 
+    if (defined($language) and $language eq 'file') {
+        # this references the translations file
+        return undef;
+    }
+
     my $translation = config_get_key3('translations', $language, $word);
     if (!defined($translation)) {
         return undef;
@@ -1422,6 +1427,9 @@ sub translations {
         @translation = split(/\|/, $translation);
     }
 
+    # get rid of the translations file
+    @translation = grep { $_ ne 'file' } @translation;
+
     return @translation;
 }
 
@@ -1448,6 +1456,10 @@ sub find_translation {
 
     # find a word in one or all languages
     foreach my $tmp (@languages) {
+        if (defined($tmp) and $tmp eq 'file') {
+            # don't try the translations file
+            next;
+        }
         if (!defined($language) or (defined($language) and $language eq $tmp)) {
             my @tmp2 = config_get_keys2('translations', $tmp);
             foreach my $tmp2 (@tmp2) {