Browse Source

+ Improved translation handling

michael 21 years ago
parent
commit
abd581ac2b
1 changed files with 26 additions and 20 deletions
  1. 26 20
      utils/fpdoc/makeskel.pp

+ 26 - 20
utils/fpdoc/makeskel.pp

@@ -201,37 +201,45 @@ begin
 end;
 end;
 
 
 procedure ParseCommandLine;
 procedure ParseCommandLine;
+
+Const
+{$IFDEF Unix}
+  MoFileTemplate = '/usr/local/share/locale/%s/LC_MESSAGES/makeskel.mo';
+{$ELSE}
+  MoFileTemplate ='intl/makeskel.%s.mo';
+{$ENDIF}
+
 var
 var
+  MOFilename: string;
   i: Integer;
   i: Integer;
 begin
 begin
+  DocLang:='';
   for i := 1 to ParamCount do
   for i := 1 to ParamCount do
     ParseOption(ParamStr(i));
     ParseOption(ParamStr(i));
+  If (DocLang<>'') then
+    begin
+    MOFilename:=Format(MOFileTemplate,[DocLang]);
+    if FileExists(MOFilename) then
+      gettext.TranslateResourceStrings(MoFileName)
+    else
+      writeln('NOTE: unable to find tranlation file ',MOFilename);
+    // Translate internal documentation strings
+    TranslateDocStrings(DocLang);
+    end;  
 end;
 end;
 
 
 
 
+
 var
 var
   i: Integer;
   i: Integer;
   Module: TPasModule;
   Module: TPasModule;
-  MOFilename: string;
+  
 begin
 begin
   InitOptions;
   InitOptions;
   ParseCommandLine;
   ParseCommandLine;
-
-{$IFDEF Unix}
-  MOFilename:='/usr/local/share/locale/%s/LC_MESSAGES/makeskel.mo';
-{$ELSE}
-  MOFilename:='intl/makeskel.%s.mo';
-{$ENDIF}
-  if FileExists(MOFilename) then
-    gettext.TranslateResourceStrings(Format(MOFilename,[doclang]))
-  else
-    writeln('NOTE: unable to find tranlation file ',MOFilename);
-
   WriteLn(STitle);
   WriteLn(STitle);
   WriteLn(SCopyright);
   WriteLn(SCopyright);
   WriteLn;
   WriteLn;
-
-
   if CmdLineAction = actionHelp then
   if CmdLineAction = actionHelp then
     WriteLn(SCmdLineHelp)
     WriteLn(SCmdLineHelp)
   else
   else
@@ -244,11 +252,6 @@ begin
       Halt(2);
       Halt(2);
     end;
     end;
 
 
-
-    // Translate internal documentation strings
-    if Length(DocLang) > 0 then
-      TranslateDocStrings(DocLang);
-
     Assign(f, OutputName);
     Assign(f, OutputName);
     Rewrite(f);
     Rewrite(f);
 
 
@@ -292,7 +295,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2004-08-24 14:48:25  michael
+  Revision 1.8  2004-08-25 07:16:43  michael
+  + Improved translation handling
+
+  Revision 1.7  2004/08/24 14:48:25  michael
   + Translate now called correctly...
   + Translate now called correctly...
 
 
   Revision 1.6  2004/05/01 20:13:40  marco
   Revision 1.6  2004/05/01 20:13:40  marco