tvplanit: Fix conversion of month/day names to utf8 in case of non-trunk Lazarus versions.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5110 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-08-29 09:39:30 +00:00
parent bb378f95b0
commit 5a8198f10d
7 changed files with 85 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ object MainForm: TMainForm
Menu = MainMenu1 Menu = MainMenu1
OnCloseQuery = FormCloseQuery OnCloseQuery = FormCloseQuery
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '1.7' LCLVersion = '1.6.0.4'
object Panel1: TPanel object Panel1: TPanel
Left = 125 Left = 125
Height = 576 Height = 576

View File

@@ -15,6 +15,8 @@ TMAINFORM.LBLADDRESSBUILDER.CAPTION=Address builder
TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing
TMAINFORM.LBLFIRSTDAYOFWEEK.CAPTION=First day of week TMAINFORM.LBLFIRSTDAYOFWEEK.CAPTION=First day of week
TMAINFORM.LBLTIMEFORMAT.CAPTION=Time format TMAINFORM.LBLTIMEFORMAT.CAPTION=Time format
TMAINFORM.CBALLOWDRAGANDDROP.CAPTION=Allow drag and drop of events
TMAINFORM.CBDRAGDROPTRANSPARENT.CAPTION=Transparent drag and drop
TMAINFORM.MENUITEM1.CAPTION=File TMAINFORM.MENUITEM1.CAPTION=File
TMAINFORM.MNUEDITPRINTFORMATS.CAPTION=Edit print formats... TMAINFORM.MNUEDITPRINTFORMATS.CAPTION=Edit print formats...
TMAINFORM.MNULOADPRINTFORMATS.CAPTION=Load print formats... TMAINFORM.MNULOADPRINTFORMATS.CAPTION=Load print formats...

View File

@@ -9,7 +9,8 @@ uses
clocale, clocale,
{$ENDIF} {$ENDIF}
Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, VpBaseDS, VpDayView, ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, LCLVersion,
VpBaseDS, VpDayView,
VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg, VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg,
VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types, VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types,
VpBase, VpCalendar; VpBase, VpCalendar;
@@ -149,15 +150,6 @@ implementation
{$R *.lfm} {$R *.lfm}
uses
{$IFDEF WINDOWS}
Windows,
{$ENDIF}
LCLVersion, LResources, LazFileUtils, LazUTF8, StrUtils, DateUtils, Translations,
IniFiles, Math, Printers,
VpMisc, VpPrtFmt,
sound, ExVpRptSetup;
{$UNDEF UTF8_CALLS} {$UNDEF UTF8_CALLS}
{$IFDEF LCL} {$IFDEF LCL}
{$DEFINE UTF8_CALLS} {$DEFINE UTF8_CALLS}
@@ -166,6 +158,19 @@ uses
{$ENDIF} {$ENDIF}
{$ENDIF} {$ENDIF}
uses
{$IFDEF WINDOWS}
Windows,
{$ENDIF}
LResources, LazFileUtils, LazUTF8, StrUtils, DateUtils, Translations,
{$IFNDEF UTF8_CALLS}
lConvEncoding,
{$ENDIF}
IniFiles, Math, Printers,
VpMisc, VpPrtFmt,
sound, ExVpRptSetup;
const const
LANGUAGE_DIR = '..\..\languages\'; LANGUAGE_DIR = '..\..\languages\';
@@ -235,12 +240,27 @@ begin
else raise Exception.CreateFmt('Language "%s" not supported. Please add to GetLCIDFromLangCode.',[ALang]); else raise Exception.CreateFmt('Language "%s" not supported. Please add to GetLCIDFromLangCode.',[ALang]);
end; end;
end; end;
function GetLocaleStr(LCID, LT: Longint; const Def: string): ShortString;
// borrowed from SysUtils
var
L: Integer;
Buf: array[0..255] of Char;
begin
L := GetLocaleInfo(LCID, LT, Buf, SizeOf(Buf));
if L > 0 then
SetString(Result, @Buf[0], L - 1)
else
Result := Def;
end;
{$ENDIF} {$ENDIF}
procedure UpdateFormatSettings(ALang: String); procedure UpdateFormatSettings(ALang: String);
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
var var
LCID: Integer; LCID: Integer;
i: Integer;
codepage: String;
{$ENDIF} {$ENDIF}
begin begin
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
@@ -252,6 +272,17 @@ begin
GetLocaleFormatSettingsUTF8(LCID, DefaultFormatSettings); GetLocaleFormatSettingsUTF8(LCID, DefaultFormatSettings);
{$ELSE} {$ELSE}
GetLocaleFormatSettings(LCID, DefaultFormatSettings); GetLocaleFormatSettings(LCID, DefaultFormatSettings);
codepage := 'cp' + GetLocaleStr(LCID, LOCALE_IDEFAULTANSICODEPAGE, '');
with DefaultFormatSettings do begin
for i:=1 to 12 do begin
LongMonthNames[i] := ConvertEncoding(LongMonthNames[i], codepage, 'utf8');
ShortMonthNames[i] := ConvertEncoding(ShortMonthNames[i], codepage, 'utf8');
end;
for i:=1 to 7 do begin
LongDayNames[i] := ConvertEncoding(LongDayNames[i], codepage, 'utf8');
ShortDayNames[i] := ConvertEncoding(ShortDayNames[i], codepage, 'utf8');
end;
end;
{$ENDIF} {$ENDIF}
{$ENDIF} {$ENDIF}
end; end;

View File

@@ -247,6 +247,16 @@ msgstr "Datei"
msgid "Help" msgid "Help"
msgstr "Hilfe" msgstr "Hilfe"
#: tmainform.menuitem3.caption
msgctxt "tmainform.menuitem3.caption"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "Über Visual PlanIt" msgstr "Über Visual PlanIt"
@@ -298,3 +308,4 @@ msgstr "Fertiggestellte Aufgaben ausblenden"
#: tmainform.titlelbl.caption #: tmainform.titlelbl.caption
msgid "TitleLbl" msgid "TitleLbl"
msgstr "" msgstr ""

View File

@@ -241,6 +241,16 @@ msgstr "Bestand"
msgid "Help" msgid "Help"
msgstr "Help" msgstr "Help"
#: tmainform.menuitem3.caption
msgctxt "tmainform.menuitem3.caption"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "Over Visual PlanIt" msgstr "Over Visual PlanIt"

View File

@@ -236,6 +236,16 @@ msgstr ""
msgid "Help" msgid "Help"
msgstr "" msgstr ""
#: tmainform.menuitem3.caption
msgctxt "TMAINFORM.MENUITEM3.CAPTION"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "" msgstr ""

View File

@@ -250,6 +250,16 @@ msgstr "Файл"
msgid "Help" msgid "Help"
msgstr "Справка" msgstr "Справка"
#: tmainform.menuitem3.caption
msgctxt "tmainform.menuitem3.caption"
msgid "-"
msgstr ""
#: tmainform.menuitem4.caption
msgctxt "tmainform.menuitem4.caption"
msgid "-"
msgstr ""
#: tmainform.mnuabout.caption #: tmainform.mnuabout.caption
msgid "About Visual PlanIt" msgid "About Visual PlanIt"
msgstr "О Visual PlanIt" msgstr "О Visual PlanIt"