1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/******************************************************************************
28 '* owner : gregor.hartmann@oracle.com
30 '* short description : Tools to ease working with language dependent strings/values
32 '\******************************************************************************
34 function hTestLocale() as boolean
37 '///<h3>Test whether we are running on an utf8 locale (Linux only)</h3><br>
39 '///<u>Parameter(s):</u><br>
41 '///+<li>No input parameters</li>
45 '///<u>Returns:</u><br>
47 '///+<li>Errorcondition (boolean)</li>
49 '///+<li>TRUE: Yes, this is a UTF-8 locale</li>
50 '///+<li>FALSE: Anything else</li>
54 const CFN = "hTestLocale::"
55 dim brc as boolean 'a multi purpose boolean returnvalue
62 '///<u>Description:</u>
65 if ( gtSysName = "Linux" ) then
67 '///+<li>Retrieve LANG</li>
68 lang = environ( "LANG" )
70 if ( instr( lang , "UTF8" ) or instr( lang , "UTF-8" ) ) then
74 '///+<li>Retrieve LC_ALL (Note that this variable is mostly set but has no value assigned)</li>
75 lc_all = environ( "LC_ALL" )
76 lc_all = ucase( lc_all )
77 if ( instr( lc_all , "UTF8" ) or instr( lc_all , "UTF-8" ) ) then
80 if ( lc_all = "" ) then
81 printlog( CFN & "No value set for LC_ALL, assuming UTF-8" )
84 printlog( CFN & "LC_ALL is set but has no UTF-8 locale" )
90 irc = 2 ' this is Windows and Solaris - they always can handle weird content
95 printlog( CFN & "UTF-8 locale found" )
98 printlog( CFN & "Please verify that you are running on UTF-8 locale" )