ADD: 'First Char Of Every Word' style for multi rename and a separate style setting for extension.

This commit is contained in:
cobines 2009-07-07 05:35:20 +00:00
commit f4cc81fb7f
5 changed files with 1299 additions and 1187 deletions

View file

@ -1,12 +1,12 @@
object frmMultiRename: TfrmMultiRename
Left = 277
Height = 388
Height = 400
Top = 253
Width = 740
Width = 684
ActiveControl = edName
Caption = 'MultiRename'
ClientHeight = 388
ClientWidth = 740
ClientHeight = 400
ClientWidth = 684
OnClose = FormClose
OnCreate = FormCreate
OnShow = FormShow
@ -18,14 +18,15 @@ object frmMultiRename: TfrmMultiRename
AnchorSideLeft.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 130
Top = 213
Width = 176
Height = 122
Top = 216
Width = 342
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 6
Caption = 'Mask'
ClientHeight = 111
ClientWidth = 172
ClientHeight = 103
ClientWidth = 338
TabOrder = 0
object lbName: TLabel
AnchorSideLeft.Control = gbMaska
@ -41,14 +42,14 @@ object frmMultiRename: TfrmMultiRename
end
object lbExt: TLabel
AnchorSideLeft.Control = gbMaska
AnchorSideTop.Control = edName
AnchorSideTop.Control = cmbNameStyle
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 52
Top = 58
Width = 64
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Top = 10
Caption = 'Extension'
ParentColor = False
end
@ -62,7 +63,7 @@ object frmMultiRename: TfrmMultiRename
Width = 136
BorderSpacing.Left = 6
BorderSpacing.Top = 2
OnChange = cmbxFontChange
OnChange = cmbNameStyleChange
TabOrder = 0
end
object edExt: TEdit
@ -72,11 +73,11 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrBottom
Left = 6
Height = 25
Top = 72
Top = 78
Width = 136
BorderSpacing.Left = 6
BorderSpacing.Top = 2
OnChange = cmbxFontChange
OnChange = cmbNameStyleChange
TabOrder = 2
end
object btnNameMenu: TButton
@ -104,7 +105,7 @@ object frmMultiRename: TfrmMultiRename
AnchorSideBottom.Side = asrBottom
Left = 146
Height = 25
Top = 72
Top = 78
Width = 20
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 4
@ -113,30 +114,83 @@ object frmMultiRename: TfrmMultiRename
OnClick = btnExtMenuClick
TabOrder = 3
end
object cmbNameStyle: TComboBox
AnchorSideLeft.Control = btnNameMenu
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnNameMenu
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = gbMaska
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 170
Height = 29
Top = 19
Width = 164
BorderSpacing.Left = 4
BorderSpacing.Right = 4
ItemHeight = 0
ItemIndex = 0
Items.Strings = (
'style'
)
OnChange = cmbNameStyleChange
Style = csDropDownList
TabOrder = 4
Text = 'style'
end
object cmbExtensionStyle: TComboBox
AnchorSideLeft.Control = btnExtMenu
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnExtMenu
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = gbMaska
AnchorSideRight.Side = asrBottom
Left = 170
Height = 29
Top = 76
Width = 164
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 4
BorderSpacing.Right = 4
ItemHeight = 0
ItemIndex = 0
Items.Strings = (
'style'
)
OnChange = cmbNameStyleChange
Style = csDropDownList
TabOrder = 5
Text = 'style'
end
end
object gbFindReplace: TGroupBox
AnchorSideLeft.Control = gbMaska
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbMaska
AnchorSideRight.Control = gbCounter
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 188
Height = 168
Top = 213
Width = 196
Left = 354
Height = 178
Top = 216
Width = 162
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 6
Caption = 'Find && Replace'
ClientHeight = 149
ClientWidth = 192
ChildSizing.TopBottomSpacing = 2
ClientHeight = 159
ClientWidth = 158
TabOrder = 1
object lbFind: TLabel
AnchorSideLeft.Control = gbFindReplace
AnchorSideTop.Control = gbFindReplace
Left = 6
Height = 18
Top = 1
Top = 6
Width = 37
BorderSpacing.Left = 6
BorderSpacing.Top = 1
BorderSpacing.Top = 6
Caption = 'Find...'
ParentColor = False
end
@ -146,7 +200,7 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 52
Top = 57
Width = 61
BorderSpacing.Left = 6
BorderSpacing.Top = 6
@ -161,13 +215,13 @@ object frmMultiRename: TfrmMultiRename
AnchorSideRight.Side = asrBottom
Left = 4
Height = 25
Top = 21
Width = 184
Top = 26
Width = 150
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 4
BorderSpacing.Top = 2
BorderSpacing.Right = 4
OnChange = cmbxFontChange
OnChange = cmbNameStyleChange
TabOrder = 0
end
object edReplace: TEdit
@ -178,13 +232,13 @@ object frmMultiRename: TfrmMultiRename
AnchorSideRight.Side = asrBottom
Left = 4
Height = 25
Top = 72
Width = 184
Top = 77
Width = 150
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 4
BorderSpacing.Top = 2
BorderSpacing.Right = 4
OnChange = cmbxFontChange
OnChange = cmbNameStyleChange
TabOrder = 1
end
object cbRegExp: TCheckBox
@ -193,10 +247,10 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrBottom
Left = 4
Height = 21
Top = 99
Top = 112
Width = 148
BorderSpacing.Left = 4
BorderSpacing.Top = 2
BorderSpacing.Top = 10
Caption = '&Regular expressions'
OnChange = cbRegExpChange
TabOrder = 2
@ -207,80 +261,38 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrBottom
Left = 4
Height = 21
Top = 120
Top = 141
Width = 126
BorderSpacing.Left = 4
BorderSpacing.Top = 8
Caption = 'Use substitution'
Enabled = False
OnChange = cmbxFontChange
OnChange = cmbNameStyleChange
TabOrder = 3
end
end
object gbFontStyle: TGroupBox
AnchorSideLeft.Control = gbCounter
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbCounter
AnchorSideRight.Side = asrBottom
Left = 566
Height = 65
Top = 213
Width = 167
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Bottom = 6
Caption = 'File Name Style'
ClientHeight = 46
ClientWidth = 163
TabOrder = 2
object cmbxFont: TComboBox
AnchorSideLeft.Control = gbFontStyle
AnchorSideTop.Control = gbFontStyle
AnchorSideRight.Control = gbFontStyle
AnchorSideRight.Side = asrBottom
Left = 4
Height = 29
Top = 6
Width = 155
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 4
BorderSpacing.Top = 6
BorderSpacing.Right = 4
ItemHeight = 0
ItemIndex = 0
Items.Strings = (
'no change'
'uppercase'
'lowercase'
'first char big'
)
OnChange = cmbxFontChange
Style = csDropDownList
TabOrder = 0
Text = 'no change'
end
end
object gbCounter: TGroupBox
AnchorSideLeft.Control = gbFindReplace
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbFindReplace
AnchorSideRight.Control = lsvwFile
AnchorSideRight.Side = asrBottom
Left = 390
Height = 119
Top = 213
Width = 170
Anchors = [akTop, akLeft, akBottom]
Left = 522
Height = 103
Top = 216
Width = 162
Anchors = [akTop, akRight, akBottom]
BorderSpacing.Left = 6
Caption = 'Counter'
ClientHeight = 100
ClientWidth = 166
TabOrder = 3
ClientHeight = 84
ClientWidth = 158
TabOrder = 2
object lbStNb: TLabel
AnchorSideLeft.Control = gbCounter
AnchorSideTop.Control = edPoc
AnchorSideTop.Side = asrCenter
Left = 6
Height = 18
Top = 9
Top = 6
Width = 84
BorderSpacing.Left = 6
Caption = 'Start Number'
@ -292,7 +304,7 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrCenter
Left = 6
Height = 18
Top = 75
Top = 72
Width = 47
BorderSpacing.Left = 6
BorderSpacing.Right = 6
@ -305,22 +317,24 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrCenter
Left = 6
Height = 18
Top = 42
Top = 39
Width = 38
BorderSpacing.Left = 6
Caption = 'Width'
ParentColor = False
end
object edPoc: TEdit
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbCounter
AnchorSideRight.Control = gbCounter
AnchorSideRight.Side = asrBottom
Left = 110
Left = 102
Height = 25
Top = 6
Top = 3
Width = 50
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
BorderSpacing.Left = 8
BorderSpacing.Top = 3
BorderSpacing.Right = 6
MaxLength = 5
OnChange = edPocChange
@ -332,9 +346,9 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbCounter
AnchorSideRight.Side = asrBottom
Left = 110
Left = 102
Height = 25
Top = 72
Top = 69
Width = 50
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
@ -349,9 +363,9 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbCounter
AnchorSideRight.Side = asrBottom
Left = 110
Left = 102
Height = 29
Top = 37
Top = 34
Width = 50
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
@ -370,53 +384,61 @@ object frmMultiRename: TfrmMultiRename
'09'
'10'
)
OnChange = cmbxFontChange
OnChange = cmbNameStyleChange
Style = csDropDownList
TabOrder = 2
Text = '01'
end
end
object btnRename: TButton
AnchorSideRight.Control = btnClose
Left = 390
AnchorSideLeft.Control = btnRestore
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnRestore
Left = 158
Height = 32
Top = 344
Width = 98
Anchors = [akRight, akBottom]
BorderSpacing.Right = 6
Top = 351
Width = 100
BorderSpacing.Left = 6
BorderSpacing.InnerBorder = 4
Caption = 'Rename'
Default = True
OnClick = btnRenameClick
TabOrder = 4
TabOrder = 3
end
object btnClose: TButton
AnchorSideRight.Control = gbLog
Left = 494
AnchorSideLeft.Control = btnRename
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnRename
Left = 264
Height = 32
Top = 344
Width = 66
Anchors = [akBottom]
BorderSpacing.Right = 6
Top = 351
Width = 82
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 6
BorderSpacing.InnerBorder = 4
Cancel = True
Caption = '&Close'
OnClick = btnCloseClick
TabOrder = 5
TabOrder = 4
end
object gbLog: TGroupBox
AnchorSideLeft.Control = gbFontStyle
AnchorSideTop.Control = gbFontStyle
AnchorSideLeft.Control = gbCounter
AnchorSideTop.Control = gbCounter
AnchorSideTop.Side = asrBottom
Left = 566
Height = 82
Top = 284
Width = 167
Anchors = [akTop, akLeft, akRight]
AnchorSideRight.Control = gbCounter
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 522
Height = 75
Top = 319
Width = 162
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Bottom = 6
Caption = 'Log Result'
ClientHeight = 63
ClientWidth = 163
TabOrder = 6
ClientHeight = 56
ClientWidth = 158
TabOrder = 5
object edFile: TEdit
AnchorSideLeft.Control = gbLog
AnchorSideTop.Control = gbLog
@ -425,7 +447,7 @@ object frmMultiRename: TfrmMultiRename
Left = 4
Height = 25
Top = 6
Width = 155
Width = 150
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 4
BorderSpacing.Top = 6
@ -438,31 +460,31 @@ object frmMultiRename: TfrmMultiRename
AnchorSideTop.Side = asrBottom
Left = 4
Height = 21
Top = 37
Top = 34
Width = 46
BorderSpacing.Left = 4
BorderSpacing.Top = 6
BorderSpacing.Top = 3
Caption = 'Log'
OnClick = cbLogClick
TabOrder = 1
end
end
object btnRestore: TButton
Left = 16
Left = 8
Height = 32
Top = 349
Top = 351
Width = 144
Anchors = [akLeft, akBottom]
BorderSpacing.InnerBorder = 4
Caption = 'Restore All'
OnClick = btnRestoreClick
TabOrder = 7
TabOrder = 6
end
object lsvwFile: TListView
Left = 2
Height = 202
Top = 2
Width = 735
Left = 0
Height = 183
Top = 8
Width = 684
Anchors = [akTop, akLeft, akRight, akBottom]
Columns = <
item
@ -478,9 +500,10 @@ object frmMultiRename: TfrmMultiRename
item
AutoSize = True
Caption = 'File Path'
Width = 514
Width = 481
end>
TabOrder = 8
ScrollBars = ssAutoBoth
TabOrder = 7
ViewStyle = vsReport
end
object ppNameMenu: TPopupMenu

View file

@ -4,13 +4,13 @@ TFRMMULTIRENAME.LBNAME.CAPTION=File Name
TFRMMULTIRENAME.LBEXT.CAPTION=Extension
TFRMMULTIRENAME.BTNNAMEMENU.CAPTION=...
TFRMMULTIRENAME.BTNEXTMENU.CAPTION=...
TFRMMULTIRENAME.CMBNAMESTYLE.TEXT=style
TFRMMULTIRENAME.CMBEXTENSIONSTYLE.TEXT=style
TFRMMULTIRENAME.GBFINDREPLACE.CAPTION=Find && Replace
TFRMMULTIRENAME.LBFIND.CAPTION=Find...
TFRMMULTIRENAME.LBREPLACE.CAPTION=Replace...
TFRMMULTIRENAME.CBREGEXP.CAPTION=&Regular expressions
TFRMMULTIRENAME.CBUSESUBS.CAPTION=Use substitution
TFRMMULTIRENAME.GBFONTSTYLE.CAPTION=File Name Style
TFRMMULTIRENAME.CMBXFONT.TEXT=no change
TFRMMULTIRENAME.GBCOUNTER.CAPTION=Counter
TFRMMULTIRENAME.LBSTNB.CAPTION=Start Number
TFRMMULTIRENAME.LBINTERVAL.CAPTION=Interval

View file

@ -20,7 +20,8 @@ interface
uses
LResources,
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, Menus, Buttons, SynRegExpr, uClassesEx, uFileList;
StdCtrls, ComCtrls, Menus, Buttons, SynRegExpr, LCLType,
uClassesEx, uFileList;
type
@ -29,6 +30,7 @@ type
TfrmMultiRename = class(TForm)
cbRegExp: TCheckBox;
cbUseSubs: TCheckBox;
cmbExtensionStyle: TComboBox;
lsvwFile: TListView;
gbMaska: TGroupBox;
lbName: TLabel;
@ -42,8 +44,7 @@ type
lbReplace: TLabel;
edFind: TEdit;
edReplace: TEdit;
gbFontStyle: TGroupBox;
cmbxFont: TComboBox;
cmbNameStyle: TComboBox;
gbCounter: TGroupBox;
lbStNb: TLabel;
lbInterval: TLabel;
@ -79,7 +80,7 @@ type
miMinute: TMenuItem;
miSecond: TMenuItem;
procedure cbRegExpChange(Sender: TObject);
procedure cmbxFontChange(Sender: TObject);
procedure cmbNameStyleChange(Sender: TObject);
procedure edPocChange(Sender: TObject);
procedure edIntervalChange(Sender: TObject);
procedure btnRenameClick(Sender: TObject);
@ -119,6 +120,16 @@ type
procedure FreshText;
{Executes the main operation of renaming files}
procedure RenameFiles;
{Changes first char to uppercase and the rest to lowercase}
function FirstCharToUppercaseUTF8(InputString: String): String;
{Changes first char of first word to uppercase and the rest to lowercase}
function FirstCharOfFirstWordToUppercaseUTF8(InputString: String): String;
{Changes first char of every word to uppercase and the rest to lowercase}
function FirstCharOfEveryWordToUppercaseUTF8(InputString: String): String;
{Returns true if a byte represents a letter.}
function IsLetter(AChar: AnsiChar): Boolean;
{Applies style (uppercase, lowercase, etc.) to a string}
function ApplyStyle(InputString: String; Style: Integer): String;
public
{ Public declarations }
FileList: TFileList;
@ -160,7 +171,9 @@ end;
procedure TfrmMultiRename.FormCreate(Sender: TObject);
begin
// Localize File name style ComboBox
ParseLineToList(rsMulRenFileNameStyleList, cmbxFont.Items);
ParseLineToList(rsMulRenFileNameStyleList, cmbNameStyle.Items);
ParseLineToList(rsMulRenFileNameStyleList, cmbExtensionStyle.Items);
// Initialize property storage
IniPropStorage:= InitPropStorage(Self);
IniPropStorage.StoredValues.Add.DisplayName:= 'lsvwFile_Columns.Item0_Width';
@ -268,20 +281,16 @@ begin
end
else
sTmpAll:=StringReplace(sTmpAll,edFind.Text,edReplace.Text,[rfReplaceAll,rfIgnoreCase]);
//file name style
case cmbxFont.ItemIndex of
1: sTmpAll:= UTF8UpperCase(sTmpAll);
2: sTmpAll:= UTF8LowerCase(sTmpAll);
3: begin
sTmpAll:= UTF8LowerCase(sTmpAll);
if UTF8Length(sTmpAll) > 0 then
begin
sTmpExt:= UTF8Copy(sTmpAll, 1, 1);
UTF8Delete(sTmpAll, 1, 1);
sTmpAll:= UTF8UpperCase(sTmpExt) + sTmpAll;
end;
end;
end;
sTmpName := ExtractOnlyFileName(sTmpAll);
sTmpExt := ExtractFileExt(sTmpAll);
sTmpName := ApplyStyle(sTmpName, cmbNameStyle.ItemIndex);
sTmpExt := ApplyStyle(sTmpExt, cmbExtensionStyle.ItemIndex);
sTmpAll := sTmpName + sTmpExt;
//save new name file
lsvwFile.Items[c].SubItems.Strings[0]:=sTmpAll;
end;
@ -299,7 +308,7 @@ begin
end;
end;
procedure TfrmMultiRename.cmbxFontChange(Sender: TObject);
procedure TfrmMultiRename.cmbNameStyleChange(Sender: TObject);
begin
FreshText;
end;
@ -368,7 +377,7 @@ begin
edExt.SelStart:=length(edExt.Text);
edFind.Text:='';
edReplace.Text:='';
cmbxFont.ItemIndex:=0;
cmbNameStyle.ItemIndex:=0;
edPoc.Text:='1';
edInterval.Text:='1';
cmbxWidth.ItemIndex:=0;
@ -628,6 +637,82 @@ begin
FreshText;
end;
function TfrmMultiRename.FirstCharToUppercaseUTF8(InputString: String): String;
var
FirstChar: String;
begin
if UTF8Length(InputString) > 0 then
begin
Result := UTF8LowerCase(InputString);
FirstChar := UTF8Copy(Result, 1, 1);
UTF8Delete(Result, 1, 1);
Result := UTF8UpperCase(FirstChar) + Result;
end
else
Result := '';
end;
function TfrmMultiRename.FirstCharOfFirstWordToUppercaseUTF8(InputString: String): String;
var
SeparatorPos: Integer;
begin
InputString := UTF8LowerCase(InputString);
Result := '';
// Search for first letter.
for SeparatorPos := 1 to Length(InputString) do
if IsLetter(InputString[SeparatorPos]) then
break;
Result := Copy(InputString, 1, SeparatorPos - 1)
+ FirstCharToUppercaseUTF8(Copy(InputString, SeparatorPos, Length(InputString) - SeparatorPos + 1));
end;
function TfrmMultiRename.FirstCharOfEveryWordToUppercaseUTF8(InputString: String): String;
var
SeparatorPos: Integer;
begin
InputString := UTF8LowerCase(InputString);
Result := '';
while InputString <> '' do
begin
// Search for first non-letter (word separator).
for SeparatorPos := 1 to Length(InputString) do
if not IsLetter(InputString[SeparatorPos]) then
break;
Result := Result
+ FirstCharToUppercaseUTF8(Copy(InputString, 1, SeparatorPos));
Delete(InputString, 1, SeparatorPos);
end;
end;
function TfrmMultiRename.IsLetter(AChar: AnsiChar): Boolean;
begin
Result := // Ascii letters
( (AChar < #128)
and
(((AChar >= 'a') and (AChar <= 'z')) or
((AChar >= 'A') and (AChar <= 'Z'))) )
or
// maybe Ansi or UTF8
(AChar >= #128);
end;
function TfrmMultiRename.ApplyStyle(InputString: String; Style: Integer): String;
begin
case Style of
1: Result := UTF8UpperCase(InputString);
2: Result := UTF8LowerCase(InputString);
3: Result := FirstCharOfFirstWordToUppercaseUTF8(InputString);
4: Result := FirstCharOfEveryWordToUppercaseUTF8(InputString);
else
Result := InputString;
end;
end;
initialization
{$I fmultirename.lrs}
end.

File diff suppressed because it is too large Load diff

View file

@ -1,325 +1,326 @@
{
Double Commander
-------------------------------------------------------------------------
Localization core unit
Copyright (C) 2007-2009 Koblov Alexander (Alexx2000@mail.ru)
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
}
unit uLng;
{$mode objfpc}{$H+}
interface
uses
LResources;
resourcestring
rsMsgNotDelete = 'Can not delete file %s';
rsMsgFileExistsRwrt = 'File %s exists, overwrite?';
rsMsgFileChangedSave = 'File %s changed, save?';
rsMsgFolderExistsRwrt = 'Folder %s exists, overwrite?';
rsMsgNewFile = 'New file';
rsMsgDelFlDr = 'Delete %d selected files/directories?';
rsMsgDelSel = 'Delete selected "%s"?';
// 12.05.2009 - another message, when deleting to trash
rsMsgDelFlDrT = 'Delete %d selected files/directories into trash can?';
rsMsgDelSelT = 'Delete selected "%s" into trash can?';
// ---
rsMsgWipeFlDr = 'Wipe %d selected files/directories?';
rsMsgWipeSel = 'Wipe selected "%s"?';
rsMsgCpFlDr = 'Copy %d selected files/directories?';
rsMsgCpSel = 'Copy selected "%s"?';
rsMsgRenFlDr = 'Rename/move %d selected files/directories?';
rsMsgRenSel = 'Rename/move selected "%s"?';
rsMsgErrForceDir = 'Can not create directory %s!';
rsMsgSelected = 'Selected %s of %s in %d of %d files';
rsMsgPopUpHotAdd = '&Add %s';
rsMsgPopUpHotCnf = '&Configure';
rsMsgCloseLockedTab = 'This tab (%s) is locked! Close anyway?';
rsDlgButtons = '&OK;&No;&Yes;&Cancel;Non&e;A&ppend;&Rewrite;Rewrite &All;&Skip;S&kip All;A&ll;';
rsSpaceMsg = 'Files: %d, Dirs: %d, Size: %s (%s bytes)';
rsSelectDir = 'Select a directory';
rsMarkPlus = 'Select mask';
rsMarkMinus = 'Unselect mask';
rsMaskInput = 'Input mask:';
rsFreeMsg = 'Free %s from %s bytes';
rsMsgErrDirExists = 'Directory %s exists!';
rsMsgPopUpHotDelete = '&Delete %s';
rsMsgDiskNotAvail = 'Disk is not available';
rsMsgChDirFailed = 'ChDir to [%s] failed!';
rsMsgNoFreeSpaceCont = 'No enough free space on target drive, Continue?';
rsMsgNoFreeSpaceRetry = 'No enough free space on target drive, Retry?';
rsMsgSetVolumeLabel = 'Set volume label';
rsMsgVolumeLabel = 'Volume label:';
rsMsgRestartForApplyChanges = 'Please, restart Double Commander in order to apply changes';
rsMsgEnterName = 'Enter name:';
rsMsgEnterFileExt = 'Enter file extension:';
rsMsgFollowSymlink = 'Follow symlink "%s"?';
rsMsgCloseAllInActiveTabs = 'Remove all inactive tabs?';
rsMsgErrRegExpSyntax = 'Syntax error in regular expression!';
rsMsgNoFilesSelected = 'No files selected.';
rsMsgTooManyFilesSelected = 'Too many files selected.';
rsMsgInvalidSelection = 'Invalid selection.';
rsMsgNotImplemented = 'Not implemented.';
rsMsgInvalidFilename = 'Invalid filename';
rsMsgSelectOnlyCheckSumFiles = 'Please select only check sum files!';
// for context menu
rsMnuActions = 'Actions';
rsMnuMount = 'Mount';
rsMnuUmount = 'Umount';
rsMnuEject = 'Eject';
// wcx module messages
rsMsgSelLocNextVol = 'Please select location of next volume';
rsMsgNextVolUnpack = 'Next volume will be unpacked';
// wcx module errors messages
rsMsgErrEndArchive = 'No more files in archive';
rsMsgErrNoMemory = 'Not enough memory';
rsMsgErrBadData = 'Data is bad';
rsMsgErrBadArchive = 'CRC error in archive data';
rsMsgErrUnknownFormat = 'Archive format unknown';
rsMsgErrEOpen = 'Cannot open existing file';
rsMsgErrECreate = 'Cannot create file';
rsMsgErrEClose = 'Error closing file';
rsMsgErrERead = 'Error reading from file';
rsMsgErrEWrite = 'Error writing to file';
rsMsgErrSmallBuf = 'Buffer too small';
rsMsgErrEAborted = 'Function aborted by user';
rsMsgErrNoFiles = 'No files found';
rsMsgErrTooManyFiles = 'Too many files to pack';
rsMsgErrNotSupported = 'Function not supported!';
// Log file
rsMsgLogSuccess = 'Done: ';
rsMsgLogError = 'Error: ';
rsMsgLogInfo = 'Info: ';
rsMsgLogCopy = 'Copy file %s';
rsMsgLogMove = 'Move file %s';
rsMsgLogDelete = 'Delete file %s';
rsMsgLogLink = 'Create link %s';
rsMsgLogSymLink = 'Create symlink %s';
rsMsgLogMkDir = 'Create directory %s';
rsMsgLogRmDir = 'Remove directory %s';
rsMsgLogPack = 'Pack to file %s';
rsMsgLogExtract = 'Extract file %s';
rsQuickSearchPanel = 'Find:';
rsSavePosition = '&Save position';
rsPositionSaved = 'Position saved.';
// File operations dialog
rsDlgSpeedTime = 'Speed %s/s, remained time %s';
rsDlgDel = 'Delete file(s)';
rsDlgCp = 'Copy file(s)';
rsDlgMv = 'Move file(s)';
rsDlgPack = 'Packing...';
rsDlgExtract = 'Extracting...';
rsDlgCheckSumCalc = 'Calculate check sum...';
rsDlgCheckSumVerify = 'Verify check sum...';
// Viewer
rsViewAboutText = 'Internal Viewer of Double Commander.';
// Editor
rsEditAboutText = 'Internal Editor of Double Commander.';
// Columns in file panel
rsColName = 'Name';
rsColExt = 'Ext';
rsColSize = 'Size';
rsColDate = 'Date';
rsColAttr = 'Attr';
// Configure custom columns dialog
rsConfColDelete = 'Delete';
rsConfColCaption = 'Caption';
rsConfColWidth = 'Width';
rsConfColAlign = 'Align';
rsConfColFieldCont = 'Field contents';
rsConfColMove='Move';
rsConfColConfig='Config';
rsConfCustHeader='Customize column';
// File properties dialog
rsPropsYes = 'Yes (%s)';
rsPropsNo = 'No';
rsPropsFolder = 'Directory';
rsPropsFile = 'File';
rsPropsSpChrDev = 'Special character device';
rsPropsSpBlkDev = 'Special block device';
rsPropsNmdPipe = 'Named pipe';
rsPropsSymLink = 'Symbolic link';
rsPropsSocket = 'Socket';
rsPropsUnknownType = 'Unknown type';
//Compare by content Dialog
rsCompareDiffs = 'Number of changes:';
// Find files dialog
rsFindScanning = 'Scanning';
rsFindScanned = 'Scanned: %d';
rsFindFound = 'Found: %d';
rsFindWhereBeg = 'Begin at';
rsFindDirNoEx = 'Directory %s does not exist!';
rsFindDepthAll = 'all (unlimited depth)';
rsFindDepthCurDir = 'current dir only';
rsFindDepth = '%s level(s)';
rsFindSaveTemplateCaption = 'Save search template';
rsFindSaveTemplateTitle = 'Template name:';
// Symlink dialog
rsSymErrCreate = 'Error creating symlink.';
// Hardlink dialog
rsHardErrCreate = 'Error creating hardlink.';
// Linker dialog
rsLinkMsgOK = 'Linker complete';
// Splitter dialog
rsSplitSelDir = 'Select directory:';
rsSplitErrFileSize = 'Incorrect file size format!';
rsSplitErrDirectory = 'Unable to create target directory!';
rsSplitErrSplitFile = 'Unable to split the file!';
rsSplitMsgCreated = 'Created:';
rsSplitMsgSize = 'size:';
// MultiRename dialog
rsMulRenFileNameStyleList = 'No change;UPPERCASE;lowercase;First Char Big;';
// Edit
rsEditNewFile = 'new.txt';
rsEditNewOpen = 'Open file';
rsEditNewFileName = 'Filename:';
// Edit search
rsEditSearchCaption = 'Search';
rsEditSearchReplace ='Replace';
rsEditSearchFrw = '&Forward';
rsEditSearchBack = '&Backward';
// Options dialog
rsOptLanguage = 'Language';
rsOptBehav = 'Behaviors';
rsOptTools = 'Tools';
rsOptFonts = 'Fonts';
rsOptColors = 'Colors';
rsOptFilePanels = 'File panels';
rsOptFileTypes = 'File types';
rsOptHotKeys = 'Hot keys';
rsOptPlugins = 'Plugins';
rsOptLayout = 'Layout';
rsOptFileOp = 'File operations';
rsOptFolderTabs = 'Folder tabs';
rsOptLog = 'Log';
rsOptConfig = 'Configuration';
rsOptQuickSearch = 'Quick search';
rsOptColumns = 'Columns';
rsOptMiscellaneous = 'Miscellaneous';
rsOptAutoRefresh = 'Auto refresh';
//-------------------------------
rsOptLineByLineCursor = 'Line by line with cursor movement';
rsOptLineByLine = 'Line by line';
rsOptPageByPage = 'Page by page';
//-------------------------------
rsOptEnterExt = 'Enter extension';
rsOptAssocPluginWith = 'Associate plugin "%s" with:';
rsOptEnable = 'Enable';
rsOptDisable = 'Disable';
rsOptMouseSelectionButton = 'Left button;Right button;';
//Columns Menu
rsMenuConfigureCustomColumns= 'Configure custom columns';
rsMenuConfigureThisCustomColumn= 'Configure this custom columns view';
function GetLanguageName(poFileName : String) : String;
procedure lngLoadLng(const sFileName:String);
procedure DoLoadLng;
implementation
uses
Classes, SysUtils, StrUtils, GetText, Translations, uGlobs, uGlobsPaths, uTranslator,
LCLProc, uFileProcs, uDCUtils, uOSUtils;
function GetLanguageName(poFileName : String) : String;
var
poFile : Integer;
sLine : String;
iPos1,
iPos2 : Integer;
begin
poFile:= mbFileOpen(poFileName, fmOpenRead);
// find first msgid line
FileReadLn(poFile, sLine);
while Pos('msgid', sLine) = 0 do
FileReadLn(poFile, sLine);
// read msgstr line
FileReadLn(poFile, sLine);
repeat
FileReadLn(poFile, sLine);
// find language name line
if Pos('X-Poedit-Language:', sLine) <> 0 then
begin
iPos1 := Pos(':', sLine) + 2;
iPos2 := Pos('\n', sLine) - 1;
Result := Copy(sLine, iPos1, (iPos2 - iPos1) + 1);
FileClose(poFile);
Exit;
end;
until Pos('msgid', sLine) = 1;
FileClose(poFile);
Result := 'Language name not found';
end;
procedure TranslateLCL(poFileName: String);
var
UserLang, LCLLngDir: String;
Lang, FallbackLang: String;
begin
LCLLngDir:= gpLngDir + PathDelim + 'lcl' + PathDelim;
if NumCountChars('.', poFileName) >= 2 then
begin
UserLang:= ExtractDelimited(2, poFileName, ['.']);
poFileName:= LCLLngDir + Format('lclstrconsts.%s.po', [UserLang]);
if not mbFileExists(poFileName) then
begin
GetLanguageIDs(Lang,FallbackLang);
poFileName:= LCLLngDir + Format('lclstrconsts.%s.po', [Lang]);
end;
if not mbFileExists(poFileName) then
poFileName:= LCLLngDir + Format('lclstrconsts.%s.po', [FallbackLang]);
if mbFileExists(poFileName) then
Translations.TranslateUnitResourceStrings('LCLStrConsts', poFileName);
end;
end;
procedure lngLoadLng(const sFileName:String);
var
Lang, FallbackLang : String;
begin
{ Localization }
if sFileName = 'doublecmd.po' then Exit; // default english interface
gPOFileName := sFileName;
if not mbFileExists(gpLngDir + gPOFileName) then
begin
gPOFileName := 'doublecmd.%s.po';
GetLanguageIDs(Lang, FallbackLang);
gPOFileName := Format(gPOFileName,[FallbackLang]);
end;
if not mbFileExists(gpLngDir + gPOFileName) then
begin
gPOFileName := Format(gPOFileName,[Lang]);
end;
if mbFileExists(gpLngDir + gPOFileName) then
begin
DebugLn('Loading lng file: ' + gpLngDir + gPOFileName);
TranslateLCL(gPOFileName);
Translations.TranslateUnitResourceStrings('uLng', gpLngDir + gPOFileName);
LRSTranslator := TTranslator.Create(gpLngDir + gPOFileName);
end;
end;
procedure DoLoadLng;
begin
lngLoadLng(gPOFileName);
end;
end.
{
Double Commander
-------------------------------------------------------------------------
Localization core unit
Copyright (C) 2007-2009 Koblov Alexander (Alexx2000@mail.ru)
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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
}
unit uLng;
{$mode objfpc}{$H+}
interface
uses
LResources;
resourcestring
rsMsgNotDelete = 'Can not delete file %s';
rsMsgFileExistsRwrt = 'File %s exists, overwrite?';
rsMsgFileChangedSave = 'File %s changed, save?';
rsMsgFolderExistsRwrt = 'Folder %s exists, overwrite?';
rsMsgNewFile = 'New file';
rsMsgDelFlDr = 'Delete %d selected files/directories?';
rsMsgDelSel = 'Delete selected "%s"?';
// 12.05.2009 - another message, when deleting to trash
rsMsgDelFlDrT = 'Delete %d selected files/directories into trash can?';
rsMsgDelSelT = 'Delete selected "%s" into trash can?';
// ---
rsMsgWipeFlDr = 'Wipe %d selected files/directories?';
rsMsgWipeSel = 'Wipe selected "%s"?';
rsMsgCpFlDr = 'Copy %d selected files/directories?';
rsMsgCpSel = 'Copy selected "%s"?';
rsMsgRenFlDr = 'Rename/move %d selected files/directories?';
rsMsgRenSel = 'Rename/move selected "%s"?';
rsMsgErrForceDir = 'Can not create directory %s!';
rsMsgSelected = 'Selected %s of %s in %d of %d files';
rsMsgPopUpHotAdd = '&Add %s';
rsMsgPopUpHotCnf = '&Configure';
rsMsgCloseLockedTab = 'This tab (%s) is locked! Close anyway?';
rsDlgButtons = '&OK;&No;&Yes;&Cancel;Non&e;A&ppend;&Rewrite;Rewrite &All;&Skip;S&kip All;A&ll;';
rsSpaceMsg = 'Files: %d, Dirs: %d, Size: %s (%s bytes)';
rsSelectDir = 'Select a directory';
rsMarkPlus = 'Select mask';
rsMarkMinus = 'Unselect mask';
rsMaskInput = 'Input mask:';
rsFreeMsg = 'Free %s from %s bytes';
rsMsgErrDirExists = 'Directory %s exists!';
rsMsgPopUpHotDelete = '&Delete %s';
rsMsgDiskNotAvail = 'Disk is not available';
rsMsgChDirFailed = 'ChDir to [%s] failed!';
rsMsgNoFreeSpaceCont = 'No enough free space on target drive, Continue?';
rsMsgNoFreeSpaceRetry = 'No enough free space on target drive, Retry?';
rsMsgSetVolumeLabel = 'Set volume label';
rsMsgVolumeLabel = 'Volume label:';
rsMsgRestartForApplyChanges = 'Please, restart Double Commander in order to apply changes';
rsMsgEnterName = 'Enter name:';
rsMsgEnterFileExt = 'Enter file extension:';
rsMsgFollowSymlink = 'Follow symlink "%s"?';
rsMsgCloseAllInActiveTabs = 'Remove all inactive tabs?';
rsMsgErrRegExpSyntax = 'Syntax error in regular expression!';
rsMsgNoFilesSelected = 'No files selected.';
rsMsgTooManyFilesSelected = 'Too many files selected.';
rsMsgInvalidSelection = 'Invalid selection.';
rsMsgNotImplemented = 'Not implemented.';
rsMsgInvalidFilename = 'Invalid filename';
rsMsgSelectOnlyCheckSumFiles = 'Please select only check sum files!';
// for context menu
rsMnuActions = 'Actions';
rsMnuMount = 'Mount';
rsMnuUmount = 'Umount';
rsMnuEject = 'Eject';
// wcx module messages
rsMsgSelLocNextVol = 'Please select location of next volume';
rsMsgNextVolUnpack = 'Next volume will be unpacked';
// wcx module errors messages
rsMsgErrEndArchive = 'No more files in archive';
rsMsgErrNoMemory = 'Not enough memory';
rsMsgErrBadData = 'Data is bad';
rsMsgErrBadArchive = 'CRC error in archive data';
rsMsgErrUnknownFormat = 'Archive format unknown';
rsMsgErrEOpen = 'Cannot open existing file';
rsMsgErrECreate = 'Cannot create file';
rsMsgErrEClose = 'Error closing file';
rsMsgErrERead = 'Error reading from file';
rsMsgErrEWrite = 'Error writing to file';
rsMsgErrSmallBuf = 'Buffer too small';
rsMsgErrEAborted = 'Function aborted by user';
rsMsgErrNoFiles = 'No files found';
rsMsgErrTooManyFiles = 'Too many files to pack';
rsMsgErrNotSupported = 'Function not supported!';
// Log file
rsMsgLogSuccess = 'Done: ';
rsMsgLogError = 'Error: ';
rsMsgLogInfo = 'Info: ';
rsMsgLogCopy = 'Copy file %s';
rsMsgLogMove = 'Move file %s';
rsMsgLogDelete = 'Delete file %s';
rsMsgLogLink = 'Create link %s';
rsMsgLogSymLink = 'Create symlink %s';
rsMsgLogMkDir = 'Create directory %s';
rsMsgLogRmDir = 'Remove directory %s';
rsMsgLogPack = 'Pack to file %s';
rsMsgLogExtract = 'Extract file %s';
rsQuickSearchPanel = 'Find:';
rsSavePosition = '&Save position';
rsPositionSaved = 'Position saved.';
// File operations dialog
rsDlgSpeedTime = 'Speed %s/s, remained time %s';
rsDlgDel = 'Delete file(s)';
rsDlgCp = 'Copy file(s)';
rsDlgMv = 'Move file(s)';
rsDlgPack = 'Packing...';
rsDlgExtract = 'Extracting...';
rsDlgCheckSumCalc = 'Calculate check sum...';
rsDlgCheckSumVerify = 'Verify check sum...';
// Viewer
rsViewAboutText = 'Internal Viewer of Double Commander.';
// Editor
rsEditAboutText = 'Internal Editor of Double Commander.';
// Columns in file panel
rsColName = 'Name';
rsColExt = 'Ext';
rsColSize = 'Size';
rsColDate = 'Date';
rsColAttr = 'Attr';
// Configure custom columns dialog
rsConfColDelete = 'Delete';
rsConfColCaption = 'Caption';
rsConfColWidth = 'Width';
rsConfColAlign = 'Align';
rsConfColFieldCont = 'Field contents';
rsConfColMove='Move';
rsConfColConfig='Config';
rsConfCustHeader='Customize column';
// File properties dialog
rsPropsYes = 'Yes (%s)';
rsPropsNo = 'No';
rsPropsFolder = 'Directory';
rsPropsFile = 'File';
rsPropsSpChrDev = 'Special character device';
rsPropsSpBlkDev = 'Special block device';
rsPropsNmdPipe = 'Named pipe';
rsPropsSymLink = 'Symbolic link';
rsPropsSocket = 'Socket';
rsPropsUnknownType = 'Unknown type';
//Compare by content Dialog
rsCompareDiffs = 'Number of changes:';
// Find files dialog
rsFindScanning = 'Scanning';
rsFindScanned = 'Scanned: %d';
rsFindFound = 'Found: %d';
rsFindWhereBeg = 'Begin at';
rsFindDirNoEx = 'Directory %s does not exist!';
rsFindDepthAll = 'all (unlimited depth)';
rsFindDepthCurDir = 'current dir only';
rsFindDepth = '%s level(s)';
rsFindSaveTemplateCaption = 'Save search template';
rsFindSaveTemplateTitle = 'Template name:';
// Symlink dialog
rsSymErrCreate = 'Error creating symlink.';
// Hardlink dialog
rsHardErrCreate = 'Error creating hardlink.';
// Linker dialog
rsLinkMsgOK = 'Linker complete';
// Splitter dialog
rsSplitSelDir = 'Select directory:';
rsSplitErrFileSize = 'Incorrect file size format!';
rsSplitErrDirectory = 'Unable to create target directory!';
rsSplitErrSplitFile = 'Unable to split the file!';
rsSplitMsgCreated = 'Created:';
rsSplitMsgSize = 'size:';
// MultiRename dialog
rsMulRenFileNameStyleList = 'No change;UPPERCASE;lowercase;First char uppercase;' +
'First Char Of Every Word Uppercase;';
// Edit
rsEditNewFile = 'new.txt';
rsEditNewOpen = 'Open file';
rsEditNewFileName = 'Filename:';
// Edit search
rsEditSearchCaption = 'Search';
rsEditSearchReplace ='Replace';
rsEditSearchFrw = '&Forward';
rsEditSearchBack = '&Backward';
// Options dialog
rsOptLanguage = 'Language';
rsOptBehav = 'Behaviors';
rsOptTools = 'Tools';
rsOptFonts = 'Fonts';
rsOptColors = 'Colors';
rsOptFilePanels = 'File panels';
rsOptFileTypes = 'File types';
rsOptHotKeys = 'Hot keys';
rsOptPlugins = 'Plugins';
rsOptLayout = 'Layout';
rsOptFileOp = 'File operations';
rsOptFolderTabs = 'Folder tabs';
rsOptLog = 'Log';
rsOptConfig = 'Configuration';
rsOptQuickSearch = 'Quick search';
rsOptColumns = 'Columns';
rsOptMiscellaneous = 'Miscellaneous';
rsOptAutoRefresh = 'Auto refresh';
//-------------------------------
rsOptLineByLineCursor = 'Line by line with cursor movement';
rsOptLineByLine = 'Line by line';
rsOptPageByPage = 'Page by page';
//-------------------------------
rsOptEnterExt = 'Enter extension';
rsOptAssocPluginWith = 'Associate plugin "%s" with:';
rsOptEnable = 'Enable';
rsOptDisable = 'Disable';
rsOptMouseSelectionButton = 'Left button;Right button;';
//Columns Menu
rsMenuConfigureCustomColumns= 'Configure custom columns';
rsMenuConfigureThisCustomColumn= 'Configure this custom columns view';
function GetLanguageName(poFileName : String) : String;
procedure lngLoadLng(const sFileName:String);
procedure DoLoadLng;
implementation
uses
Classes, SysUtils, StrUtils, GetText, Translations, uGlobs, uGlobsPaths, uTranslator,
LCLProc, uFileProcs, uDCUtils, uOSUtils;
function GetLanguageName(poFileName : String) : String;
var
poFile : Integer;
sLine : String;
iPos1,
iPos2 : Integer;
begin
poFile:= mbFileOpen(poFileName, fmOpenRead);
// find first msgid line
FileReadLn(poFile, sLine);
while Pos('msgid', sLine) = 0 do
FileReadLn(poFile, sLine);
// read msgstr line
FileReadLn(poFile, sLine);
repeat
FileReadLn(poFile, sLine);
// find language name line
if Pos('X-Poedit-Language:', sLine) <> 0 then
begin
iPos1 := Pos(':', sLine) + 2;
iPos2 := Pos('\n', sLine) - 1;
Result := Copy(sLine, iPos1, (iPos2 - iPos1) + 1);
FileClose(poFile);
Exit;
end;
until Pos('msgid', sLine) = 1;
FileClose(poFile);
Result := 'Language name not found';
end;
procedure TranslateLCL(poFileName: String);
var
UserLang, LCLLngDir: String;
Lang, FallbackLang: String;
begin
LCLLngDir:= gpLngDir + PathDelim + 'lcl' + PathDelim;
if NumCountChars('.', poFileName) >= 2 then
begin
UserLang:= ExtractDelimited(2, poFileName, ['.']);
poFileName:= LCLLngDir + Format('lclstrconsts.%s.po', [UserLang]);
if not mbFileExists(poFileName) then
begin
GetLanguageIDs(Lang,FallbackLang);
poFileName:= LCLLngDir + Format('lclstrconsts.%s.po', [Lang]);
end;
if not mbFileExists(poFileName) then
poFileName:= LCLLngDir + Format('lclstrconsts.%s.po', [FallbackLang]);
if mbFileExists(poFileName) then
Translations.TranslateUnitResourceStrings('LCLStrConsts', poFileName);
end;
end;
procedure lngLoadLng(const sFileName:String);
var
Lang, FallbackLang : String;
begin
{ Localization }
if sFileName = 'doublecmd.po' then Exit; // default english interface
gPOFileName := sFileName;
if not mbFileExists(gpLngDir + gPOFileName) then
begin
gPOFileName := 'doublecmd.%s.po';
GetLanguageIDs(Lang, FallbackLang);
gPOFileName := Format(gPOFileName,[FallbackLang]);
end;
if not mbFileExists(gpLngDir + gPOFileName) then
begin
gPOFileName := Format(gPOFileName,[Lang]);
end;
if mbFileExists(gpLngDir + gPOFileName) then
begin
DebugLn('Loading lng file: ' + gpLngDir + gPOFileName);
TranslateLCL(gPOFileName);
Translations.TranslateUnitResourceStrings('uLng', gpLngDir + gPOFileName);
LRSTranslator := TTranslator.Create(gpLngDir + gPOFileName);
end;
end;
procedure DoLoadLng;
begin
lngLoadLng(gPOFileName);
end;
end.