mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 12:39:29 +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';
|
||||
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;
|
||||
---------------------------------------------------------------------------}
|
||||
|
@ -21,6 +21,9 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
}
|
||||
uses
|
||||
windows;
|
||||
|
||||
const
|
||||
DefaultFPCSrcDirs: array[1..1] of string = (
|
||||
'C:\pp'
|
||||
@ -111,7 +114,7 @@ end;
|
||||
function FindDefaultCompilerPath: string;
|
||||
begin
|
||||
Result:=SearchFileInPath(GetDefaultCompilerFilename,'',
|
||||
GetEnvironmentVariable('PATH'),';',
|
||||
SysUtils.GetEnvironmentVariable('PATH'),';',
|
||||
[sffDontSearchInBasePath]);
|
||||
if Result<>'' then exit;
|
||||
Result:='c:\pp\bin\win32\ppc386.exe';
|
||||
@ -121,7 +124,7 @@ end;
|
||||
function FindDefaultMakePath: string;
|
||||
begin
|
||||
Result:=SearchFileInPath('make.exe','',
|
||||
GetEnvironmentVariable('PATH'),';',
|
||||
SysUtils.GetEnvironmentVariable('PATH'),';',
|
||||
[sffDontSearchInBasePath]);
|
||||
end;
|
||||
|
||||
@ -159,7 +162,7 @@ end;
|
||||
|
||||
function GetDefaultTestBuildDirectory: string;
|
||||
begin
|
||||
Result:=GetEnvironmentVariable('TEMP');
|
||||
Result:=SysUtils.GetEnvironmentVariable('TEMP');
|
||||
if Result<>'' then exit;
|
||||
Result:='c:\temp\';
|
||||
if DirPathExists(Result) then exit;
|
||||
@ -187,19 +190,45 @@ begin
|
||||
Result:='win32';
|
||||
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;
|
||||
begin
|
||||
PrimaryConfigPath:=ChompPathDelim(ExtractFilePath(Paramstr(0)));
|
||||
SecondaryConfigPath:=GetEnvironmentVariable('WINDIR');
|
||||
SecondaryConfigPath:=SysUtils.GetEnvironmentVariable('WINDIR');
|
||||
If SecondaryConfigPath = '' Then
|
||||
SecondaryConfigPath:='c:\windows';
|
||||
end;
|
||||
|
||||
{
|
||||
$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
|
||||
implemented Target Directory for IDE
|
||||
|
||||
|
@ -112,6 +112,9 @@ const
|
||||
function GetDefaultLCLWidgetType: string;
|
||||
procedure GetDefaultLCLLibPaths(List: TStrings);
|
||||
function GetDefaultLCLLibPaths(const Prefix, Postfix, Separator: string): string;
|
||||
|
||||
// returns the user language ID from the OS
|
||||
procedure GetLanguageIDs(var Lang, FallbackLang: string);
|
||||
|
||||
const
|
||||
EmptyLine = LineEnding + LineEnding;
|
||||
@ -130,7 +133,7 @@ begin
|
||||
Result:=Executable
|
||||
else
|
||||
Result:=SearchFileInPath(Executable,'',
|
||||
GetEnvironmentVariable('PATH'),':',
|
||||
SysUtils.GetEnvironmentVariable('PATH'),':',
|
||||
[sffDontSearchInBasePath]);
|
||||
end;
|
||||
|
||||
@ -222,6 +225,9 @@ end.
|
||||
|
||||
{
|
||||
$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
|
||||
implemented Target Directory for IDE
|
||||
|
||||
|
@ -79,7 +79,7 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
Dos;
|
||||
Dos, LazConf;
|
||||
|
||||
function GetLazarusLanguageLocalizedName(const ID: string): String;
|
||||
begin
|
||||
@ -201,26 +201,6 @@ begin
|
||||
TranslateUnitResourceStrings(ResUnitName,Format(BaseFilename,[Lang]));
|
||||
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
|
||||
|
||||
|
@ -624,7 +624,7 @@ begin
|
||||
OldIndex:=Notebook.PageIndex;
|
||||
if (OldIndex>=0) and (OldIndex<Notebook.PageCount) then begin
|
||||
if not GetHook(Hook) then exit;
|
||||
PageComponent:=TComponent(NoteBook.PageList[OldIndex]);
|
||||
PageComponent:=TComponent(NoteBook.Pages.Objects[OldIndex]);
|
||||
Hook.DeletePersistent(PageComponent);
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user