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

View File

@ -13,7 +13,7 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Dialogs, StdCtrls,
Buttons, customsqliteds, ComponentEditors, LazarusPackageIntf, LazIdeIntf,
fieldseditor;
fieldseditor, sqlitecompstrings;
type
@ -44,6 +44,7 @@ type
lblFilePath: TLabel;
listFields: TListBox;
DataSet: TCustomSqliteDataSet;
procedure FormCreate(Sender: TObject);
procedure LoadCurrentFields;
procedure FillComboValues;
procedure SetComboValue(AObject: TObject);
@ -98,7 +99,7 @@ begin
case Index - FVerbOffset of
0:
begin
Result := 'Create/Edit Table'
Result := sCreateEditTable
end;
else
Result := inherited GetVerb(Index);
@ -119,12 +120,12 @@ begin
ADataSet:=TCustomSqliteDataSet(GetComponent);
if ADataSet.Filename = '' then
begin
ShowMessage('FileName not set: it''s not possible to create/edit a table');
ShowMessage(sFileNameNotSetItSNotPossibleToCreateEditATable);
exit;
end;
if ADataSet.TableName = '' then
begin
ShowMessage('TableName not set: it''s not possible to create/edit a table');
ShowMessage(sTableNameNotSetItSNotPossibleToCreateEditATable);
exit;
end;
@ -181,6 +182,16 @@ begin
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;
begin
with comboFieldType.Items do
@ -210,7 +221,7 @@ begin
if AIndex <> -1 then
comboFieldType.ItemIndex:=AIndex
else
raise Exception.Create('TableEditor - FieldType not recognized');
raise Exception.Create(sTableEditorFieldTypeNotRecognized);
end;
procedure TSqliteTableEditorForm.SqliteTableEditorFormShow(Sender: TObject);
@ -225,8 +236,8 @@ begin
editFieldName.Enabled:=False;
comboFieldType.Enabled:=False;
end;
lblFilePath.Caption:='File Path: '+ExpandFileNameUTF8(DataSet.FileName);
label3.caption:='Table Name: '+ DataSet.TableName;
lblFilePath.Caption := Format(sFilePath, [ExpandFileNameUTF8(DataSet.FileName)]);
label3.caption := Format(sTableName, [DataSet.TableName]);
end;
procedure TSqliteTableEditorForm.butCancelClick(Sender: TObject);
@ -265,19 +276,19 @@ var
begin
if listFields.Items.Count = 0 then
begin;
ShowMessage('No fields added - Table will not be created');
ShowMessage(sNoFieldsAddedTableWillNotBeCreated);
Exit;
end;
if StringListHasDuplicates(listFields.Items) then
begin
ShowMessage('It''s not allowed fields with the same name');
ShowMessage(sItSNotAllowedFieldsWithTheSameName);
Exit;
end;
if Dataset.TableExists then
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
exit
else
@ -293,9 +304,9 @@ begin
DataSet.CreateTable;
if Dataset.TableExists then
ShowMessage('Table created successfully')
ShowMessage(sTableCreatedSuccessfully)
else
ShowMessage('It was not possible to create the table');
ShowMessage(sItWasNotPossibleToCreateTheTable);
end;
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>
<Package Version="3">
<Package Version="4">
<Name Value="sqlitelaz"/>
<Type Value="RunAndDesignTime"/>
<AddToProjectUsesSection Value="True"/>
<Author Value="Luiz Américo Pereira Câmara"/>
<CompilerOptions>
<Version Value="8"/>
<Version Value="11"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
</CompilerOptions>
<Description Value="TSqliteDataset class package
"/>
<License Value="Modified LGPL
"/>
<Version Minor="4"/>
<Files Count="3">
<Files Count="4">
<Item1>
<Filename Value="registersqlite.pas"/>
<HasRegisterProc Value="True"/>
@ -25,8 +29,8 @@
</Item1>
<Item2>
<Filename Value="sqliteds.pas"/>
<AddToUsesPkgSection Value="False"/>
<Type Value="Virtual Unit"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="sqliteds"/>
</Item2>
<Item3>
@ -34,8 +38,16 @@
<AddToUsesPkgSection Value="False"/>
<UnitName Value="SqliteComponentEditor"/>
</Item3>
<Item4>
<Filename Value="sqlitecompstrings.pas"/>
<UnitName Value="sqlitecompstrings"/>
</Item4>
</Files>
<Type Value="RunAndDesignTime"/>
<i18n>
<EnableI18N Value="True"/>
<OutDir Value="languages"/>
<EnableI18NForLFM Value="True"/>
</i18n>
<RequiredPkgs Count="2">
<Item1>
<PackageName Value="LCL"/>
@ -45,7 +57,7 @@
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>

View File

@ -1,21 +1,21 @@
{ 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
uses
registersqlite, LazarusPackageIntf;
registersqlite, sqlitecompstrings, LazarusPackageIntf;
implementation
procedure Register;
procedure Register;
begin
RegisterUnit('registersqlite', @registersqlite.Register);
end;
RegisterUnit('registersqlite', @registersqlite.Register);
end;
initialization
RegisterPackage('sqlitelaz', @Register);
RegisterPackage('sqlitelaz', @Register);
end.