Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 124556
Collapse All | Expand All

(-)src/org/eclipse/hyades/logging/parsers/ParserUtilities.java (-3 / +4 lines)
Lines 19-24 Link Here
19
import java.util.StringTokenizer;
19
import java.util.StringTokenizer;
20
20
21
import org.eclipse.hyades.internal.logging.core.Constants;
21
import org.eclipse.hyades.internal.logging.core.Constants;
22
import org.eclipse.hyades.logging.core.LoggingCoreUtilities;
22
23
23
/**
24
/**
24
 * 
25
 * 
Lines 40-46 Link Here
40
	    if(key != null){
41
	    if(key != null){
41
	        
42
	        
42
		    //Load ResourceBundle:
43
		    //Load ResourceBundle:
43
	        if (resourceBundle == null) {
44
	        if (resourceBundle == null || !resourceBundle.getLocale().equals(LoggingCoreUtilities.getClientLocale()))  {
44
	        	/* Bugzilla 106671 - the non plugin.xml strings like messages have 
45
	        	/* Bugzilla 106671 - the non plugin.xml strings like messages have 
45
	        	 * been moved from plugin.properties to a file called  
46
	        	 * been moved from plugin.properties to a file called  
46
	        	 * org.eclipse.hyades.logging.parsers.properties/messages.properties.
47
	        	 * org.eclipse.hyades.logging.parsers.properties/messages.properties.
Lines 52-58 Link Here
52
	        	 * eclipse and non-eclipse environments.
53
	        	 * eclipse and non-eclipse environments.
53
	        	 */
54
	        	 */
54
                try {
55
                try {
55
                    resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_LOCATION, Locale.getDefault());
56
                    resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_LOCATION, LoggingCoreUtilities.getClientLocale());
56
                }
57
                }
57
                catch (MissingResourceException m) {
58
                catch (MissingResourceException m) {
58
                	// Return the key if the resource bundle is not found.
59
                	// Return the key if the resource bundle is not found.
Lines 129-135 Link Here
129
130
130
        if (key != null) {
131
        if (key != null) {
131
132
132
            Locale defaultLocale = Locale.getDefault();
133
            Locale defaultLocale = LoggingCoreUtilities.getClientLocale();
133
134
134
            if ((locale != null) && (!locale.equals(defaultLocale))) {
135
            if ((locale != null) && (!locale.equals(defaultLocale))) {
135
136
(-)src.import/org/eclipse/hyades/logging/parsers/importer/RemoteLogParserLoader.java (-5 / +7 lines)
Lines 237-249 Link Here
237
            if(parserParameters.containsKey(LogParserConstants.CLIENT_LOCALE_LANGUAGE_KEY)){
237
            if(parserParameters.containsKey(LogParserConstants.CLIENT_LOCALE_LANGUAGE_KEY)){
238
238
239
                String clientLanguage = ((String)(parserParameters.get(LogParserConstants.CLIENT_LOCALE_LANGUAGE_KEY)));
239
                String clientLanguage = ((String)(parserParameters.get(LogParserConstants.CLIENT_LOCALE_LANGUAGE_KEY)));
240
240
                System.setProperty(LogParserConstants.CLIENT_LOCALE_LANGUAGE_KEY, clientLanguage);
241
                if(parserParameters.containsKey(LogParserConstants.CLIENT_LOCALE_COUNTRY_KEY)){
241
                if(parserParameters.containsKey(LogParserConstants.CLIENT_LOCALE_COUNTRY_KEY)){
242
242
243
                    String clientCountry = ((String)(parserParameters.get(LogParserConstants.CLIENT_LOCALE_LANGUAGE_KEY)));
243
                    String clientCountry = ((String)(parserParameters.get(LogParserConstants.CLIENT_LOCALE_COUNTRY_KEY)));
244
244
                    System.setProperty(LogParserConstants.CLIENT_LOCALE_COUNTRY_KEY, clientCountry);
245
                    
245
                    if(parserParameters.containsKey(LogParserConstants.CLIENT_LOCALE_VARIANT_KEY)){
246
                    if(parserParameters.containsKey(LogParserConstants.CLIENT_LOCALE_VARIANT_KEY)){
246
                        clientLocale = new Locale(clientLanguage,clientCountry,((String)(parserParameters.get(LogParserConstants.CLIENT_LOCALE_VARIANT_KEY))));
247
                        String variant = (String) parserParameters.get(LogParserConstants.CLIENT_LOCALE_VARIANT_KEY);
248
                        System.setProperty(LogParserConstants.CLIENT_LOCALE_VARIANT_KEY, variant);
249
                        clientLocale = new Locale(clientLanguage,clientCountry,variant);
247
                    }
250
                    }
248
                    else{
251
                    else{
249
                        clientLocale = new Locale(clientLanguage,clientCountry);
252
                        clientLocale = new Locale(clientLanguage,clientCountry);
Lines 254-260 Link Here
254
                }
257
                }
255
            }
258
            }
256
259
257
258
            //Assume this is a PreemptedLogger and recover if necessary:
260
            //Assume this is a PreemptedLogger and recover if necessary:
259
            if (logger instanceof IPreemptedLogger) {
261
            if (logger instanceof IPreemptedLogger) {
260
262
(-)src/org/eclipse/hyades/internal/logging/core/internationalization/InternationalizationUtilities.java (-1 / +3 lines)
Lines 3-8 Link Here
3
import java.util.Locale;
3
import java.util.Locale;
4
import java.util.StringTokenizer;
4
import java.util.StringTokenizer;
5
5
6
import org.eclipse.hyades.logging.core.LoggingCoreUtilities;
7
6
/**********************************************************************
8
/**********************************************************************
7
 * Copyright (c) 2006, 2008 IBM Corporation and others.
9
 * Copyright (c) 2006, 2008 IBM Corporation and others.
8
 * All rights reserved.   This program and the accompanying materials
10
 * All rights reserved.   This program and the accompanying materials
Lines 116-122 Link Here
116
	 * @see InternationalizationUtilities#format(String, Object[], com.ibm.icu.util.ULocale)
118
	 * @see InternationalizationUtilities#format(String, Object[], com.ibm.icu.util.ULocale)
117
     */
119
     */
118
    public static String format(String message, Object[] arguments) throws IllegalArgumentException {
120
    public static String format(String message, Object[] arguments) throws IllegalArgumentException {
119
		return (format(message, arguments, Locale.getDefault()));
121
		return (format(message, arguments, LoggingCoreUtilities.getClientLocale()));
120
    }
122
    }
121
    
123
    
122
    /**
124
    /**
(-)src.cbe101/org/eclipse/hyades/logging/events/cbe/EventException.java (-1 / +2 lines)
Lines 7-12 Link Here
7
import java.util.ResourceBundle;
7
import java.util.ResourceBundle;
8
8
9
import org.eclipse.hyades.internal.logging.core.internationalization.InternationalizationUtilities;
9
import org.eclipse.hyades.internal.logging.core.internationalization.InternationalizationUtilities;
10
import org.eclipse.hyades.logging.core.LoggingCoreUtilities;
10
11
11
/**********************************************************************
12
/**********************************************************************
12
 * Copyright (c) 2005, 2008 IBM Corporation and others.
13
 * Copyright (c) 2005, 2008 IBM Corporation and others.
Lines 279-285 Link Here
279
     * @return The localized exception message.
280
     * @return The localized exception message.
280
     */
281
     */
281
    public String getLocalizedMessage() {
282
    public String getLocalizedMessage() {
282
        return getLocalizedMessage(Locale.getDefault());
283
        return getLocalizedMessage(LoggingCoreUtilities.getClientLocale());
283
    }
284
    }
284
285
285
    /**
286
    /**
(-)src/org/eclipse/hyades/logging/core/LoggingCoreResourceBundle.java (-2 / +2 lines)
Lines 63-72 Link Here
63
        synchronized(RESOURCE_BUNDLE_NAME){
63
        synchronized(RESOURCE_BUNDLE_NAME){
64
            
64
            
65
            //Load the resource bundle:
65
            //Load the resource bundle:
66
            if (resourceBundle == null) {                
66
            if (resourceBundle == null || !resourceBundle.getLocale().equals(LoggingCoreUtilities.getClientLocale())) {                
67
                //Attempt to load the 'org.eclipse.hyades.logging.core.properties.message[_<language code>[_<country code>]].properties' resource bundle:
67
                //Attempt to load the 'org.eclipse.hyades.logging.core.properties.message[_<language code>[_<country code>]].properties' resource bundle:
68
                try {
68
                try {
69
                    resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME);
69
                    resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME,LoggingCoreUtilities.getClientLocale());
70
                }
70
                }
71
                catch (MissingResourceException m) {
71
                catch (MissingResourceException m) {
72
                    return key;
72
                    return key;
(-)src/org/eclipse/hyades/logging/core/LoggingCoreUtilities.java (+43 lines)
Lines 513-516 Link Here
513
513
514
		return (InternationalizationUtilities.format(utcMilliseconds, dateFormatPattern, Locale.ENGLISH, "GMT"));        		
514
		return (InternationalizationUtilities.format(utcMilliseconds, dateFormatPattern, Locale.ENGLISH, "GMT"));        		
515
    }
515
    }
516
    
517
    public final static String CLIENT_LOCALE_LANGUAGE_KEY = "client_locale_language";
518
    public final static String CLIENT_LOCALE_COUNTRY_KEY = "client_locale_country";
519
    public final static String CLIENT_LOCALE_VARIANT_KEY = "client_locale_variant";
520
    
521
    private static Locale _clientLocale = null;
522
    
523
    /**
524
     * Returns either the Locale specified using System properties LoggingCoreUtilities.CLIENT_LOCALE_LANGUAGE_KEY, 
525
     * LoggingCoreUtilities.CLIENT_LOCALE_COUNTRY_KEY and LoggingCoreUtilities.CLIENT_LOCALE_VARIANT_KEY or the current Default Locale.
526
     * @return Locale
527
     */
528
    public static Locale getClientLocale()
529
    {
530
        if(_clientLocale == null)
531
        {
532
            String clientLanguage = System.getProperty(CLIENT_LOCALE_LANGUAGE_KEY);
533
            
534
            if(clientLanguage !=null)
535
            {
536
                String clientCountry = System.getProperty(CLIENT_LOCALE_COUNTRY_KEY);
537
                
538
                if(clientCountry!=null)
539
                {
540
                    String variant = System.getProperty(CLIENT_LOCALE_VARIANT_KEY);
541
                    
542
                    if(variant!=null)
543
                    {
544
                        _clientLocale = new Locale(clientLanguage,clientCountry,variant);
545
                    }
546
                    else{
547
                        _clientLocale = new Locale(clientLanguage,clientCountry);
548
                    }
549
                }
550
                else
551
                {
552
                    _clientLocale = new Locale(clientLanguage);
553
                }
554
            }
555
        }        
556
        
557
        return _clientLocale!=null?_clientLocale:Locale.getDefault();
558
    }
516
}
559
}
(-)src.events/org/eclipse/tptp/logging/events/cbe/EventException.java (-1 / +2 lines)
Lines 7-12 Link Here
7
import java.util.ResourceBundle;
7
import java.util.ResourceBundle;
8
8
9
import org.eclipse.hyades.internal.logging.core.internationalization.InternationalizationUtilities;
9
import org.eclipse.hyades.internal.logging.core.internationalization.InternationalizationUtilities;
10
import org.eclipse.hyades.logging.core.LoggingCoreUtilities;
10
11
11
/**********************************************************************
12
/**********************************************************************
12
 * Copyright (c) 2005, 2008 IBM Corporation and others.
13
 * Copyright (c) 2005, 2008 IBM Corporation and others.
Lines 274-280 Link Here
274
     * @return The localized exception message.
275
     * @return The localized exception message.
275
     */
276
     */
276
    public String getLocalizedMessage() {
277
    public String getLocalizedMessage() {
277
        return getLocalizedMessage(Locale.getDefault());
278
        return getLocalizedMessage(LoggingCoreUtilities.getClientLocale());
278
    }
279
    }
279
280
280
    /**
281
    /**
(-)src/org/eclipse/hyades/logging/adapter/util/Messages.java (-3 / +3 lines)
Lines 13-23 Link Here
13
 **********************************************************************/
13
 **********************************************************************/
14
14
15
import java.text.MessageFormat;
15
import java.text.MessageFormat;
16
import java.util.Locale;
17
import java.util.MissingResourceException;
16
import java.util.MissingResourceException;
18
import java.util.ResourceBundle;
17
import java.util.ResourceBundle;
19
18
20
import org.eclipse.hyades.logging.adapter.internal.util.UtilConstants;
19
import org.eclipse.hyades.logging.adapter.internal.util.UtilConstants;
20
import org.eclipse.hyades.logging.core.LoggingCoreUtilities;
21
21
22
/**
22
/**
23
 * This class contains various operations to retrieve translated messages.
23
 * This class contains various operations to retrieve translated messages.
Lines 40-46 Link Here
40
    public static String getString(String key) {
40
    public static String getString(String key) {
41
41
42
        //Load ResourceBundle:
42
        //Load ResourceBundle:
43
        if (resourceBundle == null) {
43
        if (resourceBundle == null || !resourceBundle.getLocale().equals(LoggingCoreUtilities.getClientLocale()))  {
44
44
45
	        /* Bugzilla 106671 - the non plugin.xml strings like messages have 
45
	        /* Bugzilla 106671 - the non plugin.xml strings like messages have 
46
        	 * been moved from plugin.properties to a file called  
46
        	 * been moved from plugin.properties to a file called  
Lines 53-59 Link Here
53
        	 * eclipse and non-eclipse environments.
53
        	 * eclipse and non-eclipse environments.
54
        	 */
54
        	 */
55
            try {
55
            try {
56
                resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME, Locale.getDefault());
56
                resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_NAME, LoggingCoreUtilities.getClientLocale());
57
            }
57
            }
58
            catch (MissingResourceException m) {
58
            catch (MissingResourceException m) {
59
				// Cannot find resource bundle.  Return the key.
59
				// Cannot find resource bundle.  Return the key.

Return to bug 124556