]> git.pld-linux.org Git - packages/libreoffice.git/blob - openoffice-i18n-sal.patch
- up
[packages/libreoffice.git] / openoffice-i18n-sal.patch
1 Index: sal/util/sal.map
2 ===================================================================
3 RCS file: /cvs/porting/sal/util/sal.map,v
4 retrieving revision 1.42
5 diff -u -p -u -r1.42 sal.map
6 --- sal/util/sal.map    4 Apr 2003 10:46:19 -0000       1.42
7 +++ sal/util/sal.map    14 Oct 2003 16:43:46 -0000
8 @@ -86,6 +86,7 @@ UDK_3_0_0 {
9          osl_getSocketOption;
10          osl_getSocketType;
11          osl_getSymbol;
12 +        osl_getSystemLocale;
13          osl_getSystemPathFromFileURL;
14          osl_getSystemTime;
15          osl_getThreadIdentifier;
16 Index: sal/inc/rtl/locale.h
17 ===================================================================
18 RCS file: /cvs/porting/sal/inc/rtl/locale.h,v
19 retrieving revision 1.3
20 diff -u -p -u -r1.3 locale.h
21 --- sal/inc/rtl/locale.h        26 Apr 2001 13:34:01 -0000      1.3
22 +++ sal/inc/rtl/locale.h        14 Oct 2003 16:43:58 -0000
23 @@ -130,6 +130,15 @@ rtl_Locale * SAL_CALL rtl_locale_registe
24  rtl_Locale * SAL_CALL rtl_locale_getDefault();
25  
26  /**
27 +   As above - but actually useful - and not strangely deprecated,
28 +   and with no setter.
29 + */
30 +typedef enum {
31 +               rtl_LocaleSystemMessages,
32 +               rtl_LocaleSystemCType
33 +} rtl_LocaleSystemType;
34 +
35 +/**
36         Sets the default.
37         Normally set once at the beginning of applet or application,
38         then never reset. <code>setDefault</code> does not reset the host locale.
39 Index: sal/inc/rtl/locale.hxx
40 ===================================================================
41 RCS file: /cvs/porting/sal/inc/rtl/locale.hxx,v
42 retrieving revision 1.3
43 diff -u -p -u -r1.3 locale.hxx
44 --- sal/inc/rtl/locale.hxx      26 Apr 2001 13:34:01 -0000      1.3
45 +++ sal/inc/rtl/locale.hxx      14 Oct 2003 16:43:58 -0000
46 @@ -263,6 +263,16 @@ public:
47          */
48         OUString getVariant() const { return pData->Variant; }
49  
50 +    /**
51 +           Getter for lang-country name
52 +        */
53 +    inline OUString getRawName()
54 +    {
55 +        rtl::OUString aRaw = ( getLanguage() +
56 +                                                          rtl::OUString::createFromAscii( "-" ) + 
57 +                                                          getCountry() );
58 +               return aRaw;
59 +       }
60  
61         /**
62                 Returns the hash code of the locale This.
63 Index: sal/inc/osl/process.h
64 ===================================================================
65 RCS file: /cvs/porting/sal/inc/osl/process.h,v
66 retrieving revision 1.14
67 diff -u -p -u -r1.14 process.h
68 --- sal/inc/osl/process.h       26 Mar 2003 16:45:37 -0000      1.14
69 +++ sal/inc/osl/process.h       14 Oct 2003 16:44:16 -0000
70 @@ -360,6 +360,8 @@ oslProcessError SAL_CALL osl_getProcessL
71  */
72  
73  oslProcessError SAL_CALL osl_setProcessLocale( rtl_Locale * pLocale );
74 +
75 +rtl_Locale * SAL_CALL osl_getSystemLocale( rtl_LocaleSystemType nType );
76   
77  
78  sal_Bool SAL_CALL osl_sendResourcePipe(oslPipe Pipe, oslSocket Socket);
79 Index: sal/osl/unx/nlsupport.c
80 ===================================================================
81 RCS file: /cvs/porting/sal/osl/unx/nlsupport.c,v
82 retrieving revision 1.21
83 diff -u -p -u -r1.21 nlsupport.c
84 --- sal/osl/unx/nlsupport.c     16 Jul 2003 17:21:12 -0000      1.21
85 +++ sal/osl/unx/nlsupport.c     14 Oct 2003 16:44:29 -0000
86 @@ -1347,3 +1347,46 @@ int _imp_setProcessLocale( rtl_Locale * 
87  #endif /* ifdef LINUX || SOLARIS || MACOSX || NETBSD */
88  
89  
90 +
91 +// Get locale of category LC_CTYPE of environment variables
92 +static sal_Char* GetLangFromEnvironment()
93 +{
94 +    static sal_Char* pFallback = "C";
95 +    sal_Char *pLang = NULL;
96 +
97 +    pLang = getenv ( "LC_ALL" );
98 +    if (! pLang)
99 +        pLang = getenv ( "LC_CTYPE" );
100 +    if (! pLang)
101 +        pLang = getenv( "LANG" );
102 +    if (! pLang)
103 +        pLang = pFallback;
104 +
105 +    return pLang;
106 +}
107 +
108 +rtl_Locale * SAL_CALL osl_getSystemLocale( rtl_LocaleSystemType nType )
109 +{
110 +    const char *pMessages[] = { "LANGUAGE", "LC_ALL", "LC_MESSAGES", "LANG", NULL };
111 +       const char *pCType[]    = { "LC_ALL", "LC_CTYPE", NULL };
112 +       const char **pScan;
113 +       const char *pLang = NULL;
114 +       static rtl_Locale *pLocales[2] = { NULL, NULL };
115 +       
116 +       if( !pLocales[ nType ] )
117 +       {
118 +               pScan = (nType == rtl_LocaleSystemMessages) ? pMessages : pCType;
119 +               while (*pScan)
120 +               {
121 +               if( pLang = getenv( *pScan ) )
122 +                               break;
123 +                       pScan++;
124 +               }
125 +               if( !pLang )
126 +                       pLang = "C";
127 +
128 +               pLocales[ nType ] = _parse_locale( pLang );
129 +       }
130 +               
131 +       return pLocales[ nType ];
132 +}              
This page took 0.040318 seconds and 3 git commands to generate.