From f43220d638dbd2c314c1a88dc5a708abff1404c1 Mon Sep 17 00:00:00 2001 From: maxim Date: Tue, 3 Feb 2015 00:02:46 +0000 Subject: [PATCH] =?UTF-8?q?Components,=20sqlite:=20i18n=20and=20layout=20i?= =?UTF-8?q?mprovement,=20patch=20by=20P=C3=A9ter=20G=C3=A1bor,=20bug=20#27?= =?UTF-8?q?390=20with=20string=20corrections.=20Also=20added=20Russian=20t?= =?UTF-8?q?ranslation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: trunk@47585 - --- .gitattributes | 3 + .../sqlite/languages/sqlitecompstrings.po | 71 ++++++++++++++++ .../sqlite/languages/sqlitecompstrings.ru.po | 80 +++++++++++++++++++ components/sqlite/sqlitecomponenteditor.lfm | 55 ++++++------- components/sqlite/sqlitecomponenteditor.pas | 35 +++++--- components/sqlite/sqlitecompstrings.pas | 29 +++++++ components/sqlite/sqlitelaz.lpk | 32 +++++--- components/sqlite/sqlitelaz.pas | 14 ++-- 8 files changed, 263 insertions(+), 56 deletions(-) create mode 100644 components/sqlite/languages/sqlitecompstrings.po create mode 100644 components/sqlite/languages/sqlitecompstrings.ru.po create mode 100644 components/sqlite/sqlitecompstrings.pas diff --git a/.gitattributes b/.gitattributes index 0f55295774..85668597f5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/components/sqlite/languages/sqlitecompstrings.po b/components/sqlite/languages/sqlitecompstrings.po new file mode 100644 index 0000000000..1198cc94b5 --- /dev/null +++ b/components/sqlite/languages/sqlitecompstrings.po @@ -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 "" + diff --git a/components/sqlite/languages/sqlitecompstrings.ru.po b/components/sqlite/languages/sqlitecompstrings.ru.po new file mode 100644 index 0000000000..cc5250e698 --- /dev/null +++ b/components/sqlite/languages/sqlitecompstrings.ru.po @@ -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 \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 "Имя таблицы не задано: невозможно создать/редактировать таблицу." + diff --git a/components/sqlite/sqlitecomponenteditor.lfm b/components/sqlite/sqlitecomponenteditor.lfm index 5f8afe549c..38d3e873cf 100644 --- a/components/sqlite/sqlitecomponenteditor.lfm +++ b/components/sqlite/sqlitecomponenteditor.lfm @@ -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 diff --git a/components/sqlite/sqlitecomponenteditor.pas b/components/sqlite/sqlitecomponenteditor.pas index 2f38b4fe62..eb299ac43e 100644 --- a/components/sqlite/sqlitecomponenteditor.pas +++ b/components/sqlite/sqlitecomponenteditor.pas @@ -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); diff --git a/components/sqlite/sqlitecompstrings.pas b/components/sqlite/sqlitecompstrings.pas new file mode 100644 index 0000000000..4d233ece2f --- /dev/null +++ b/components/sqlite/sqlitecompstrings.pas @@ -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. + diff --git a/components/sqlite/sqlitelaz.lpk b/components/sqlite/sqlitelaz.lpk index 9760a35da1..b553f228a8 100644 --- a/components/sqlite/sqlitelaz.lpk +++ b/components/sqlite/sqlitelaz.lpk @@ -1,23 +1,27 @@ - + - + + + - + - - - + + + + + - + @@ -25,8 +29,8 @@ - + @@ -34,8 +38,16 @@ + + + + - + + + + + @@ -45,7 +57,7 @@ - + diff --git a/components/sqlite/sqlitelaz.pas b/components/sqlite/sqlitelaz.pas index 447f276de4..4ef29082ea 100644 --- a/components/sqlite/sqlitelaz.pas +++ b/components/sqlite/sqlitelaz.pas @@ -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.