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
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
LCLVersion = '1.7'
LCLVersion = '1.6.0.4'
object Panel1: TPanel
Left = 125
Height = 576

View File

@@ -15,6 +15,8 @@ TMAINFORM.LBLADDRESSBUILDER.CAPTION=Address builder
TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing
TMAINFORM.LBLFIRSTDAYOFWEEK.CAPTION=First day of week
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.MNUEDITPRINTFORMATS.CAPTION=Edit print formats...
TMAINFORM.MNULOADPRINTFORMATS.CAPTION=Load print formats...

View File

@@ -9,7 +9,8 @@ uses
clocale,
{$ENDIF}
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,
VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, VpPrtFmtDlg, Types,
VpBase, VpCalendar;
@@ -149,15 +150,6 @@ implementation
{$R *.lfm}
uses
{$IFDEF WINDOWS}
Windows,
{$ENDIF}
LCLVersion, LResources, LazFileUtils, LazUTF8, StrUtils, DateUtils, Translations,
IniFiles, Math, Printers,
VpMisc, VpPrtFmt,
sound, ExVpRptSetup;
{$UNDEF UTF8_CALLS}
{$IFDEF LCL}
{$DEFINE UTF8_CALLS}
@@ -166,6 +158,19 @@ uses
{$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
LANGUAGE_DIR = '..\..\languages\';
@@ -235,12 +240,27 @@ begin
else raise Exception.CreateFmt('Language "%s" not supported. Please add to GetLCIDFromLangCode.',[ALang]);
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}
procedure UpdateFormatSettings(ALang: String);
{$IFDEF WINDOWS}
var
LCID: Integer;
i: Integer;
codepage: String;
{$ENDIF}
begin
{$IFDEF WINDOWS}
@@ -252,6 +272,17 @@ begin
GetLocaleFormatSettingsUTF8(LCID, DefaultFormatSettings);
{$ELSE}
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}
end;

View File

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

View File

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

View File

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

View File

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