Components, sqlite: i18n and layout improvement, patch by Péter Gábor, bug #27390 with string corrections. Also added Russian translation.

git-svn-id: trunk@47585 -
This commit is contained in:
maxim 2015-02-03 00:02:46 +00:00
parent 8de1e2482d
commit f43220d638
8 changed files with 263 additions and 56 deletions

3
.gitattributes vendored
View File

@ -3293,6 +3293,8 @@ components/sqldb/sqldblaz.lpk svneol=native#text/pascal
components/sqldb/sqldblaz.pas svneol=native#text/pascal components/sqldb/sqldblaz.pas svneol=native#text/pascal
components/sqldb/sqlstringspropertyeditordlg.lfm svneol=native#text/plain components/sqldb/sqlstringspropertyeditordlg.lfm svneol=native#text/plain
components/sqldb/sqlstringspropertyeditordlg.pas svneol=native#text/plain components/sqldb/sqlstringspropertyeditordlg.pas svneol=native#text/plain
components/sqlite/languages/sqlitecompstrings.po svneol=native#text/plain
components/sqlite/languages/sqlitecompstrings.ru.po svneol=native#text/plain
components/sqlite/lib/README.txt svneol=native#text/plain components/sqlite/lib/README.txt svneol=native#text/plain
components/sqlite/registersqlite.pas svneol=native#text/plain components/sqlite/registersqlite.pas svneol=native#text/plain
components/sqlite/registersqlite3.pas svneol=native#text/plain components/sqlite/registersqlite3.pas svneol=native#text/plain
@ -3301,6 +3303,7 @@ components/sqlite/sqlite3laz.lpk svneol=native#text/plain
components/sqlite/sqlite3laz.pas svneol=native#text/plain components/sqlite/sqlite3laz.pas svneol=native#text/plain
components/sqlite/sqlitecomponenteditor.lfm svneol=native#text/plain components/sqlite/sqlitecomponenteditor.lfm svneol=native#text/plain
components/sqlite/sqlitecomponenteditor.pas svneol=native#text/plain components/sqlite/sqlitecomponenteditor.pas svneol=native#text/plain
components/sqlite/sqlitecompstrings.pas svneol=native#text/pascal
components/sqlite/sqliteicon.res -text components/sqlite/sqliteicon.res -text
components/sqlite/sqlitelaz.lpk svneol=native#text/plain components/sqlite/sqlitelaz.lpk svneol=native#text/plain
components/sqlite/sqlitelaz.pas svneol=native#text/plain components/sqlite/sqlitelaz.pas svneol=native#text/plain

View File

@ -0,0 +1,71 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: sqlitecompstrings.sadd
msgid "Add"
msgstr ""
#: sqlitecompstrings.satablenamedalreadyexistsareyousureyouwanttoreplace
msgid "A Table named \"%s\" already exists. Are you sure you want to replace this table?%sAll data stored will be lost."
msgstr ""
#: sqlitecompstrings.sclose
msgid "Close"
msgstr ""
#: sqlitecompstrings.screateedittable
msgid "Create/Edit Table"
msgstr ""
#: sqlitecompstrings.screatetable
msgid "Create Table"
msgstr ""
#: sqlitecompstrings.sdelete
msgid "Delete"
msgstr ""
#: sqlitecompstrings.sfieldname
msgid "Field Name"
msgstr ""
#: sqlitecompstrings.sfieldtype
msgid "Field Type"
msgstr ""
#: sqlitecompstrings.sfilenamenotsetitsnotpossibletocreateeditatable
msgid "File name not set: it's not possible to create/edit a table."
msgstr ""
#: sqlitecompstrings.sfilepath
msgid "File Path: %s"
msgstr ""
#: sqlitecompstrings.sitsnotallowedfieldswiththesamename
msgid "Fields with identical names are not allowed."
msgstr ""
#: sqlitecompstrings.sitwasnotpossibletocreatethetable
msgid "It was not possible to create the table."
msgstr ""
#: sqlitecompstrings.snofieldsaddedtablewillnotbecreated
msgid "No fields added. Table will not be created."
msgstr ""
#: sqlitecompstrings.stablecreatedsuccessfully
msgid "Table created successfully."
msgstr ""
#: sqlitecompstrings.stableeditorfieldtypenotrecognized
msgid "Field type not recognized."
msgstr ""
#: sqlitecompstrings.stablename
msgid "Table Name: %s"
msgstr ""
#: sqlitecompstrings.stablenamenotsetitsnotpossibletocreateeditatable
msgid "Table name not set: it's not possible to create/edit a table."
msgstr ""

View File

@ -0,0 +1,80 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Maxim Ganetsky <maxkill@mail.ru>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: sqlitecompstrings.sadd
msgid "Add"
msgstr "Добавить"
#: sqlitecompstrings.satablenamedalreadyexistsareyousureyouwanttoreplace
msgid "A Table named \"%s\" already exists. Are you sure you want to replace this table?%sAll data stored will be lost."
msgstr "Таблица с именем \"%s\" уже имеется. Вы уверены, что хотите заменить её?%sВсе данные будут утеряны."
#: sqlitecompstrings.sclose
msgid "Close"
msgstr "Закрыть"
#: sqlitecompstrings.screateedittable
msgid "Create/Edit Table"
msgstr "Создание/редактирование таблицы"
#: sqlitecompstrings.screatetable
msgid "Create Table"
msgstr "Создать таблицу"
#: sqlitecompstrings.sdelete
msgid "Delete"
msgstr "Удалить"
#: sqlitecompstrings.sfieldname
msgid "Field Name"
msgstr "Имя поля"
#: sqlitecompstrings.sfieldtype
msgid "Field Type"
msgstr "Тип поля"
#: sqlitecompstrings.sfilenamenotsetitsnotpossibletocreateeditatable
msgid "File name not set: it's not possible to create/edit a table."
msgstr "Имя файла не задано: невозможно создать/редактировать таблицу."
#: sqlitecompstrings.sfilepath
msgid "File Path: %s"
msgstr "Путь к файлу: %s"
#: sqlitecompstrings.sitsnotallowedfieldswiththesamename
msgid "Fields with identical names are not allowed."
msgstr "Поля с одинаковыми именами не разрешаются."
#: sqlitecompstrings.sitwasnotpossibletocreatethetable
msgid "It was not possible to create the table."
msgstr "Не удалось создать таблицу."
#: sqlitecompstrings.snofieldsaddedtablewillnotbecreated
#| msgid "No fields added - Table will not be created"
msgid "No fields added. Table will not be created."
msgstr "Не добавлены поля. Таблица не будет создана."
#: sqlitecompstrings.stablecreatedsuccessfully
msgid "Table created successfully."
msgstr "Таблица успешно создана."
#: sqlitecompstrings.stableeditorfieldtypenotrecognized
msgid "Field type not recognized."
msgstr "Тип поля не опознан."
#: sqlitecompstrings.stablename
msgid "Table Name: %s"
msgstr "Имя таблицы: %s"
#: sqlitecompstrings.stablenamenotsetitsnotpossibletocreateeditatable
msgid "Table name not set: it's not possible to create/edit a table."
msgstr "Имя таблицы не задано: невозможно создать/редактировать таблицу."

View File

@ -1,41 +1,42 @@
object SqliteTableEditorForm: TSqliteTableEditorForm object SqliteTableEditorForm: TSqliteTableEditorForm
Left = 373 Left = 561
Height = 269 Height = 269
Top = 244 Top = 231
Width = 290 Width = 363
ActiveControl = butAdd ActiveControl = butAdd
Caption = 'Sqlite Table Editor' Caption = 'Sqlite Table Editor'
ClientHeight = 269 ClientHeight = 269
ClientWidth = 290 ClientWidth = 363
OnCreate = FormCreate
OnShow = SqliteTableEditorFormShow OnShow = SqliteTableEditorFormShow
LCLVersion = '0.9.27' LCLVersion = '1.5'
object Label1: TLabel object Label1: TLabel
Left = 147 Left = 215
Height = 14 Height = 13
Top = 64 Top = 64
Width = 53 Width = 56
Caption = 'Field Name' Caption = 'Field Name'
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel
Left = 147 Left = 215
Height = 14 Height = 13
Top = 120 Top = 120
Width = 50 Width = 49
Caption = 'Field Type' Caption = 'Field Type'
ParentColor = False ParentColor = False
end end
object lblFilePath: TLabel object lblFilePath: TLabel
Left = 8 Left = 8
Height = 14 Height = 13
Top = 4 Top = 4
Width = 49 Width = 51
Caption = 'lblFilePath' Caption = 'lblFilePath'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label3: TLabel
Left = 8 Left = 8
Height = 14 Height = 13
Top = 20 Top = 20
Width = 32 Width = 32
Caption = 'Label3' Caption = 'Label3'
@ -45,13 +46,15 @@ object SqliteTableEditorForm: TSqliteTableEditorForm
Left = 8 Left = 8
Height = 192 Height = 192
Top = 64 Top = 64
Width = 124 Width = 192
ItemHeight = 0 ItemHeight = 0
OnSelectionChange = listFieldsSelectionChange OnSelectionChange = listFieldsSelectionChange
ScrollWidth = 190
TabOrder = 6 TabOrder = 6
TopIndex = -1
end end
object butCreate: TButton object butCreate: TButton
Left = 147 Left = 215
Height = 25 Height = 25
Top = 192 Top = 192
Width = 136 Width = 136
@ -61,9 +64,9 @@ object SqliteTableEditorForm: TSqliteTableEditorForm
TabStop = False TabStop = False
end end
object butClose: TButton object butClose: TButton
Left = 147 Left = 215
Height = 25 Height = 25
Top = 232 Top = 231
Width = 136 Width = 136
Caption = 'Close' Caption = 'Close'
OnClick = butCancelClick OnClick = butCancelClick
@ -71,7 +74,7 @@ object SqliteTableEditorForm: TSqliteTableEditorForm
TabStop = False TabStop = False
end end
object editFieldName: TEdit object editFieldName: TEdit
Left = 147 Left = 215
Height = 23 Height = 23
Top = 80 Top = 80
Width = 136 Width = 136
@ -79,14 +82,12 @@ object SqliteTableEditorForm: TSqliteTableEditorForm
TabOrder = 4 TabOrder = 4
end end
object comboFieldType: TComboBox object comboFieldType: TComboBox
Left = 147 Left = 215
Height = 21 Height = 27
Top = 136 Top = 136
Width = 136 Width = 136
AutoComplete = False
DropDownCount = 12 DropDownCount = 12
ItemHeight = 13 ItemHeight = 0
ItemWidth = 0
OnChange = comboFieldTypeChange OnChange = comboFieldTypeChange
Style = csDropDownList Style = csDropDownList
TabOrder = 5 TabOrder = 5
@ -95,16 +96,16 @@ object SqliteTableEditorForm: TSqliteTableEditorForm
Left = 8 Left = 8
Height = 25 Height = 25
Top = 40 Top = 40
Width = 64 Width = 97
Caption = 'Add' Caption = 'Add'
OnClick = butAddClick OnClick = butAddClick
TabOrder = 0 TabOrder = 0
end end
object butDelete: TButton object butDelete: TButton
Left = 72 Left = 105
Height = 25 Height = 25
Top = 40 Top = 40
Width = 60 Width = 95
Caption = 'Delete' Caption = 'Delete'
OnClick = butDeleteClick OnClick = butDeleteClick
TabOrder = 3 TabOrder = 3

View File

@ -13,7 +13,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Dialogs, StdCtrls, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Dialogs, StdCtrls,
Buttons, customsqliteds, ComponentEditors, LazarusPackageIntf, LazIdeIntf, Buttons, customsqliteds, ComponentEditors, LazarusPackageIntf, LazIdeIntf,
fieldseditor; fieldseditor, sqlitecompstrings;
type type
@ -44,6 +44,7 @@ type
lblFilePath: TLabel; lblFilePath: TLabel;
listFields: TListBox; listFields: TListBox;
DataSet: TCustomSqliteDataSet; DataSet: TCustomSqliteDataSet;
procedure FormCreate(Sender: TObject);
procedure LoadCurrentFields; procedure LoadCurrentFields;
procedure FillComboValues; procedure FillComboValues;
procedure SetComboValue(AObject: TObject); procedure SetComboValue(AObject: TObject);
@ -98,7 +99,7 @@ begin
case Index - FVerbOffset of case Index - FVerbOffset of
0: 0:
begin begin
Result := 'Create/Edit Table' Result := sCreateEditTable
end; end;
else else
Result := inherited GetVerb(Index); Result := inherited GetVerb(Index);
@ -119,12 +120,12 @@ begin
ADataSet:=TCustomSqliteDataSet(GetComponent); ADataSet:=TCustomSqliteDataSet(GetComponent);
if ADataSet.Filename = '' then if ADataSet.Filename = '' then
begin begin
ShowMessage('FileName not set: it''s not possible to create/edit a table'); ShowMessage(sFileNameNotSetItSNotPossibleToCreateEditATable);
exit; exit;
end; end;
if ADataSet.TableName = '' then if ADataSet.TableName = '' then
begin begin
ShowMessage('TableName not set: it''s not possible to create/edit a table'); ShowMessage(sTableNameNotSetItSNotPossibleToCreateEditATable);
exit; exit;
end; end;
@ -181,6 +182,16 @@ begin
end; end;
end; end;
procedure TSqliteTableEditorForm.FormCreate(Sender: TObject);
begin
Label1.Caption := sFieldName;
Label2.Caption := sFieldType;
butCreate.Caption := sCreateTable;
butClose.Caption := sClose;
butAdd.Caption := sAdd;
butDelete.Caption := sDelete;
end;
procedure TSqliteTableEditorForm.FillComboValues; procedure TSqliteTableEditorForm.FillComboValues;
begin begin
with comboFieldType.Items do with comboFieldType.Items do
@ -210,7 +221,7 @@ begin
if AIndex <> -1 then if AIndex <> -1 then
comboFieldType.ItemIndex:=AIndex comboFieldType.ItemIndex:=AIndex
else else
raise Exception.Create('TableEditor - FieldType not recognized'); raise Exception.Create(sTableEditorFieldTypeNotRecognized);
end; end;
procedure TSqliteTableEditorForm.SqliteTableEditorFormShow(Sender: TObject); procedure TSqliteTableEditorForm.SqliteTableEditorFormShow(Sender: TObject);
@ -225,8 +236,8 @@ begin
editFieldName.Enabled:=False; editFieldName.Enabled:=False;
comboFieldType.Enabled:=False; comboFieldType.Enabled:=False;
end; end;
lblFilePath.Caption:='File Path: '+ExpandFileNameUTF8(DataSet.FileName); lblFilePath.Caption := Format(sFilePath, [ExpandFileNameUTF8(DataSet.FileName)]);
label3.caption:='Table Name: '+ DataSet.TableName; label3.caption := Format(sTableName, [DataSet.TableName]);
end; end;
procedure TSqliteTableEditorForm.butCancelClick(Sender: TObject); procedure TSqliteTableEditorForm.butCancelClick(Sender: TObject);
@ -265,19 +276,19 @@ var
begin begin
if listFields.Items.Count = 0 then if listFields.Items.Count = 0 then
begin; begin;
ShowMessage('No fields added - Table will not be created'); ShowMessage(sNoFieldsAddedTableWillNotBeCreated);
Exit; Exit;
end; end;
if StringListHasDuplicates(listFields.Items) then if StringListHasDuplicates(listFields.Items) then
begin begin
ShowMessage('It''s not allowed fields with the same name'); ShowMessage(sItSNotAllowedFieldsWithTheSameName);
Exit; Exit;
end; end;
if Dataset.TableExists then if Dataset.TableExists then
begin begin
if MessageDlg('A Table named "'+Dataset.TableName+'" already exists. Are you sure you want to replace this table?'#13#10'All data stored will be lost', if MessageDlg(Format(sATableNamedAlreadyExistsAreYouSureYouWantToReplace, [Dataset.TableName, LineEnding]),
mtWarning,[mbYes,MbNo],0) = mrNo then mtWarning,[mbYes,MbNo],0) = mrNo then
exit exit
else else
@ -293,9 +304,9 @@ begin
DataSet.CreateTable; DataSet.CreateTable;
if Dataset.TableExists then if Dataset.TableExists then
ShowMessage('Table created successfully') ShowMessage(sTableCreatedSuccessfully)
else else
ShowMessage('It was not possible to create the table'); ShowMessage(sItWasNotPossibleToCreateTheTable);
end; end;
procedure TSqliteTableEditorForm.comboFieldTypeChange(Sender: TObject); procedure TSqliteTableEditorForm.comboFieldTypeChange(Sender: TObject);

View File

@ -0,0 +1,29 @@
unit sqlitecompstrings;
{$mode objfpc}{$H+}
interface
resourcestring
sFilePath = 'File Path: %s';
sTableName = 'Table Name: %s';
sNoFieldsAddedTableWillNotBeCreated = 'No fields added. Table will not be created.';
sItSNotAllowedFieldsWithTheSameName = 'Fields with identical names are not allowed.';
sTableCreatedSuccessfully = 'Table created successfully.';
sItWasNotPossibleToCreateTheTable = 'It was not possible to create the table.';
sTableEditorFieldTypeNotRecognized = 'Field type not recognized.';
sTableNameNotSetItSNotPossibleToCreateEditATable = 'Table name not set: it''s not possible to create/edit a table.';
sFileNameNotSetItSNotPossibleToCreateEditATable = 'File name not set: it''s not possible to create/edit a table.';
sCreateEditTable = 'Create/Edit Table';
sATableNamedAlreadyExistsAreYouSureYouWantToReplace = 'A Table named "%s" already exists. Are you sure you want to replace this table?%sAll data stored will be lost.';
sFieldName = 'Field Name';
sFieldType = 'Field Type';
sCreateTable = 'Create Table';
sClose = 'Close';
sAdd = 'Add';
sDelete = 'Delete';
implementation
end.

View File

@ -1,23 +1,27 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<Package Version="3"> <Package Version="4">
<Name Value="sqlitelaz"/> <Name Value="sqlitelaz"/>
<Type Value="RunAndDesignTime"/>
<AddToProjectUsesSection Value="True"/>
<Author Value="Luiz Américo Pereira Câmara"/> <Author Value="Luiz Américo Pereira Câmara"/>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<SearchPaths> <SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)"/>
</SearchPaths> </SearchPaths>
<Other> <Parsing>
<CompilerPath Value="$(CompPath)"/> <SyntaxOptions>
</Other> <UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
</CompilerOptions> </CompilerOptions>
<Description Value="TSqliteDataset class package <Description Value="TSqliteDataset class package
"/> "/>
<License Value="Modified LGPL <License Value="Modified LGPL
"/> "/>
<Version Minor="4"/> <Version Minor="4"/>
<Files Count="3"> <Files Count="4">
<Item1> <Item1>
<Filename Value="registersqlite.pas"/> <Filename Value="registersqlite.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
@ -25,8 +29,8 @@
</Item1> </Item1>
<Item2> <Item2>
<Filename Value="sqliteds.pas"/> <Filename Value="sqliteds.pas"/>
<AddToUsesPkgSection Value="False"/>
<Type Value="Virtual Unit"/> <Type Value="Virtual Unit"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="sqliteds"/> <UnitName Value="sqliteds"/>
</Item2> </Item2>
<Item3> <Item3>
@ -34,8 +38,16 @@
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="SqliteComponentEditor"/> <UnitName Value="SqliteComponentEditor"/>
</Item3> </Item3>
<Item4>
<Filename Value="sqlitecompstrings.pas"/>
<UnitName Value="sqlitecompstrings"/>
</Item4>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <i18n>
<EnableI18N Value="True"/>
<OutDir Value="languages"/>
<EnableI18NForLFM Value="True"/>
</i18n>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">
<Item1> <Item1>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
@ -45,7 +57,7 @@
</Item2> </Item2>
</RequiredPkgs> </RequiredPkgs>
<UsageOptions> <UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/> <UnitPath Value="$(PkgOutDir)"/>
</UsageOptions> </UsageOptions>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@ -1,21 +1,21 @@
{ This file was automatically created by Lazarus. Do not edit! { This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package. This source is only used to compile and install the package.
} }
unit sqlitelaz; unit sqlitelaz;
interface interface
uses uses
registersqlite, LazarusPackageIntf; registersqlite, sqlitecompstrings, LazarusPackageIntf;
implementation implementation
procedure Register; procedure Register;
begin begin
RegisterUnit('registersqlite', @registersqlite.Register); RegisterUnit('registersqlite', @registersqlite.Register);
end; end;
initialization initialization
RegisterPackage('sqlitelaz', @Register); RegisterPackage('sqlitelaz', @Register);
end. end.