Forráskód Böngészése

ADD: File with available help files translations, use it when open online help

Alexander Koblov 4 éve
szülő
commit
46c1b70416

+ 1 - 0
doublecmd.help

@@ -0,0 +1 @@
+ru

+ 1 - 0
install/darwin/install.sh

@@ -32,6 +32,7 @@ mkdir -p $DC_INSTALL_DIR/plugins/wfx/ftp
 # Copy files
 cp -r doublecmd.app/*              $DC_APP_DIR/
 cp -a doublecmd                    $DC_INSTALL_DIR/
+cp -a doublecmd.help               $DC_INSTALL_DIR/
 cp -a doublecmd.zdli               $DC_INSTALL_DIR/
 cp -a doublecmd.ext.example        $DC_INSTALL_DIR/
 cp -a pixmaps.txt                  $DC_INSTALL_DIR/

+ 1 - 0
install/linux/install.sh

@@ -70,6 +70,7 @@ mkdir -p $DC_INSTALL_DIR/plugins/dsx/dsxlocate
 
 # Copy files
 cp -a doublecmd                    $DC_INSTALL_DIR/
+cp -a doublecmd.help               $DC_INSTALL_DIR/
 cp -a doublecmd.zdli               $DC_INSTALL_DIR/
 cp -a doublecmd.ext.example        $DC_INSTALL_DIR/
 cp -a pixmaps.txt                  $DC_INSTALL_DIR/

+ 1 - 0
install/windows/install.bat

@@ -31,6 +31,7 @@ xcopy /E highlighters %DC_INSTALL_DIR%\highlighters\
 rem Copy files
 copy doc\*.txt                      %DC_INSTALL_DIR%\doc\
 copy doublecmd.exe                  %DC_INSTALL_DIR%\
+copy doublecmd.help                 %DC_INSTALL_DIR%\
 copy doublecmd.zdli                 %DC_INSTALL_DIR%\
 copy doublecmd.ext.example          %DC_INSTALL_DIR%\
 copy pixmaps.txt                    %DC_INSTALL_DIR%\

+ 16 - 7
src/dmhelpmanager.pas

@@ -3,7 +3,7 @@
     -------------------------------------------------------------------------
     Help manager
 
-    Copyright (C) 2008  Koblov Alexander (A[email protected])
+    Copyright (C) 2008-2021 Alexander Koblov (a[email protected])
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -16,8 +16,7 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    along with this program. If not, see <http://www.gnu.org/licenses/>.
 }
 
 unit dmHelpManager;
@@ -58,7 +57,7 @@ uses
   {$ELSE}
   HelpIntfs,
   {$ENDIF}
-  uGlobsPaths, uGlobs, DCStrUtils, DCOSUtils, StrUtils;
+  uGlobsPaths, uGlobs, DCStrUtils, DCOSUtils, StrUtils, DCClassesUtf8;
 
 {$IF DEFINED(MSWINDOWS)}
 procedure OpenURLWithAnchor(URL: String);
@@ -100,15 +99,25 @@ procedure TdmHelpManager.DataModuleCreate(Sender: TObject);
 var
   ABrowser, AParams: String;
 {$ENDIF}
+var
+  ATranslations: TStringList;
 begin
   if NumCountChars('.', gPOFileName) < 2 then
     gHelpLang:= 'en'
-  else
+  else begin
+    gHelpLang:= ExtractDelimited(2, gPOFileName, ['.']);
+    if not mbDirectoryExists(gpExePath + 'doc' + PathDelim + gHelpLang) then
     begin
-      gHelpLang:= ExtractDelimited(2, gPOFileName, ['.']);
-      if not mbDirectoryExists(gpExePath + 'doc' + PathDelim + gHelpLang) then
+      ATranslations:= TStringListEx.Create;
+      try
+        ATranslations.LoadFromFile(gpExePath + 'doublecmd.help');
+        if ATranslations.IndexOf(gHelpLang) < 0 then gHelpLang:= 'en';
+      except
         gHelpLang:= 'en';
+      end;
+      ATranslations.Free;
     end;
+  end;
 
   if mbDirectoryExists(gpExePath + 'doc' + PathDelim + gHelpLang) then
     HTMLHelpDatabase.BaseURL:= 'file://' + gpExePath + 'doc' + PathDelim + gHelpLang