mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:39:22 +02:00
moved GetLanguageIDs from Translations to LazConf
git-svn-id: trunk@6352 -
This commit is contained in:
parent
809c5a0cec
commit
6425889e6e
@ -194,6 +194,26 @@ begin
|
|||||||
Result:='gtk';
|
Result:='gtk';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure GetLanguageIDs(var Lang, FallbackLang: string);
|
||||||
|
begin
|
||||||
|
Lang := GetEnv('LC_ALL');
|
||||||
|
FallbackLang:='';
|
||||||
|
|
||||||
|
if Length(Lang) = 0 then
|
||||||
|
begin
|
||||||
|
Lang := GetEnv('LC_MESSAGES');
|
||||||
|
if Length(Lang) = 0 then
|
||||||
|
begin
|
||||||
|
Lang := GetEnv('LANG');
|
||||||
|
if Length(Lang) = 0 then
|
||||||
|
exit; // no language defined via environment variables
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FallbackLang := Copy(Lang, 1, 2);
|
||||||
|
Lang := Copy(Lang, 1, 5);
|
||||||
|
end;
|
||||||
|
|
||||||
{---------------------------------------------------------------------------
|
{---------------------------------------------------------------------------
|
||||||
procedure InternalInit;
|
procedure InternalInit;
|
||||||
---------------------------------------------------------------------------}
|
---------------------------------------------------------------------------}
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
}
|
}
|
||||||
|
uses
|
||||||
|
windows;
|
||||||
|
|
||||||
const
|
const
|
||||||
DefaultFPCSrcDirs: array[1..1] of string = (
|
DefaultFPCSrcDirs: array[1..1] of string = (
|
||||||
'C:\pp'
|
'C:\pp'
|
||||||
@ -111,7 +114,7 @@ end;
|
|||||||
function FindDefaultCompilerPath: string;
|
function FindDefaultCompilerPath: string;
|
||||||
begin
|
begin
|
||||||
Result:=SearchFileInPath(GetDefaultCompilerFilename,'',
|
Result:=SearchFileInPath(GetDefaultCompilerFilename,'',
|
||||||
GetEnvironmentVariable('PATH'),';',
|
SysUtils.GetEnvironmentVariable('PATH'),';',
|
||||||
[sffDontSearchInBasePath]);
|
[sffDontSearchInBasePath]);
|
||||||
if Result<>'' then exit;
|
if Result<>'' then exit;
|
||||||
Result:='c:\pp\bin\win32\ppc386.exe';
|
Result:='c:\pp\bin\win32\ppc386.exe';
|
||||||
@ -121,7 +124,7 @@ end;
|
|||||||
function FindDefaultMakePath: string;
|
function FindDefaultMakePath: string;
|
||||||
begin
|
begin
|
||||||
Result:=SearchFileInPath('make.exe','',
|
Result:=SearchFileInPath('make.exe','',
|
||||||
GetEnvironmentVariable('PATH'),';',
|
SysUtils.GetEnvironmentVariable('PATH'),';',
|
||||||
[sffDontSearchInBasePath]);
|
[sffDontSearchInBasePath]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -159,7 +162,7 @@ end;
|
|||||||
|
|
||||||
function GetDefaultTestBuildDirectory: string;
|
function GetDefaultTestBuildDirectory: string;
|
||||||
begin
|
begin
|
||||||
Result:=GetEnvironmentVariable('TEMP');
|
Result:=SysUtils.GetEnvironmentVariable('TEMP');
|
||||||
if Result<>'' then exit;
|
if Result<>'' then exit;
|
||||||
Result:='c:\temp\';
|
Result:='c:\temp\';
|
||||||
if DirPathExists(Result) then exit;
|
if DirPathExists(Result) then exit;
|
||||||
@ -187,19 +190,45 @@ begin
|
|||||||
Result:='win32';
|
Result:='win32';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure GetLanguageIDs(var Lang, FallbackLang: string);
|
||||||
|
var
|
||||||
|
Buffer: array[1..4] of char;
|
||||||
|
Country: string;
|
||||||
|
UserLCID: LCID;
|
||||||
|
begin
|
||||||
|
//defaults
|
||||||
|
Lang := '';
|
||||||
|
FallbackLang:='';
|
||||||
|
UserLCID := GetUserDefaultLCID;
|
||||||
|
if GetLocaleInfo(UserLCID, LOCALE_SABBREVLANGNAME, @Buffer, 4)<>0 then
|
||||||
|
FallbackLang := lowercase(copy(Buffer,1,2));
|
||||||
|
if GetLocaleInfo(UserLCID, LOCALE_SABBREVCTRYNAME, @Buffer, 4)<>0 then begin
|
||||||
|
Country := copy(Buffer,1,2);
|
||||||
|
|
||||||
|
// some 2 letter codes are not the first two letters of the 3 letter code
|
||||||
|
// there are probably more, but first let us see if there are translations
|
||||||
|
if (Buffer='PRT') then Country:='PT';
|
||||||
|
|
||||||
|
Lang := FallbackLang+'_'+Country;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{---------------------------------------------------------------------------
|
{---------------------------------------------------------------------------
|
||||||
procedure InternalInit;
|
procedure InternalInit;
|
||||||
---------------------------------------------------------------------------}
|
---------------------------------------------------------------------------}
|
||||||
procedure InternalInit;
|
procedure InternalInit;
|
||||||
begin
|
begin
|
||||||
PrimaryConfigPath:=ChompPathDelim(ExtractFilePath(Paramstr(0)));
|
PrimaryConfigPath:=ChompPathDelim(ExtractFilePath(Paramstr(0)));
|
||||||
SecondaryConfigPath:=GetEnvironmentVariable('WINDIR');
|
SecondaryConfigPath:=SysUtils.GetEnvironmentVariable('WINDIR');
|
||||||
If SecondaryConfigPath = '' Then
|
If SecondaryConfigPath = '' Then
|
||||||
SecondaryConfigPath:='c:\windows';
|
SecondaryConfigPath:='c:\windows';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.26 2004/12/09 14:30:12 vincents
|
||||||
|
moved GetLanguageIDs from Translations to LazConf
|
||||||
|
|
||||||
Revision 1.25 2004/12/04 01:17:41 mattias
|
Revision 1.25 2004/12/04 01:17:41 mattias
|
||||||
implemented Target Directory for IDE
|
implemented Target Directory for IDE
|
||||||
|
|
||||||
|
@ -112,6 +112,9 @@ const
|
|||||||
function GetDefaultLCLWidgetType: string;
|
function GetDefaultLCLWidgetType: string;
|
||||||
procedure GetDefaultLCLLibPaths(List: TStrings);
|
procedure GetDefaultLCLLibPaths(List: TStrings);
|
||||||
function GetDefaultLCLLibPaths(const Prefix, Postfix, Separator: string): string;
|
function GetDefaultLCLLibPaths(const Prefix, Postfix, Separator: string): string;
|
||||||
|
|
||||||
|
// returns the user language ID from the OS
|
||||||
|
procedure GetLanguageIDs(var Lang, FallbackLang: string);
|
||||||
|
|
||||||
const
|
const
|
||||||
EmptyLine = LineEnding + LineEnding;
|
EmptyLine = LineEnding + LineEnding;
|
||||||
@ -130,7 +133,7 @@ begin
|
|||||||
Result:=Executable
|
Result:=Executable
|
||||||
else
|
else
|
||||||
Result:=SearchFileInPath(Executable,'',
|
Result:=SearchFileInPath(Executable,'',
|
||||||
GetEnvironmentVariable('PATH'),':',
|
SysUtils.GetEnvironmentVariable('PATH'),':',
|
||||||
[sffDontSearchInBasePath]);
|
[sffDontSearchInBasePath]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -222,6 +225,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.35 2004/12/09 14:30:12 vincents
|
||||||
|
moved GetLanguageIDs from Translations to LazConf
|
||||||
|
|
||||||
Revision 1.34 2004/12/04 01:17:41 mattias
|
Revision 1.34 2004/12/04 01:17:41 mattias
|
||||||
implemented Target Directory for IDE
|
implemented Target Directory for IDE
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Dos;
|
Dos, LazConf;
|
||||||
|
|
||||||
function GetLazarusLanguageLocalizedName(const ID: string): String;
|
function GetLazarusLanguageLocalizedName(const ID: string): String;
|
||||||
begin
|
begin
|
||||||
@ -201,26 +201,6 @@ begin
|
|||||||
TranslateUnitResourceStrings(ResUnitName,Format(BaseFilename,[Lang]));
|
TranslateUnitResourceStrings(ResUnitName,Format(BaseFilename,[Lang]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure GetLanguageIDs(var Lang, FallbackLang: string);
|
|
||||||
begin
|
|
||||||
Lang := GetEnv('LC_ALL');
|
|
||||||
FallbackLang:='';
|
|
||||||
|
|
||||||
if Length(Lang) = 0 then
|
|
||||||
begin
|
|
||||||
Lang := GetEnv('LC_MESSAGES');
|
|
||||||
if Length(Lang) = 0 then
|
|
||||||
begin
|
|
||||||
Lang := GetEnv('LANG');
|
|
||||||
if Length(Lang) = 0 then
|
|
||||||
exit; // no language defined via environment variables
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
FallbackLang := Copy(Lang, 1, 2);
|
|
||||||
Lang := Copy(Lang, 1, 5);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
TranslateResourceStrings
|
TranslateResourceStrings
|
||||||
|
|
||||||
|
@ -624,7 +624,7 @@ begin
|
|||||||
OldIndex:=Notebook.PageIndex;
|
OldIndex:=Notebook.PageIndex;
|
||||||
if (OldIndex>=0) and (OldIndex<Notebook.PageCount) then begin
|
if (OldIndex>=0) and (OldIndex<Notebook.PageCount) then begin
|
||||||
if not GetHook(Hook) then exit;
|
if not GetHook(Hook) then exit;
|
||||||
PageComponent:=TComponent(NoteBook.PageList[OldIndex]);
|
PageComponent:=TComponent(NoteBook.Pages.Objects[OldIndex]);
|
||||||
Hook.DeletePersistent(PageComponent);
|
Hook.DeletePersistent(PageComponent);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user