trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/Messages.java
changeset 11 5b9d4d8641ce
equal deleted inserted replaced
10:ed1c9f64298a 11:5b9d4d8641ce
       
     1 /*
       
     2  * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  * String localization for engine package.
       
    17  *
       
    18  */
       
    19 package com.nokia.traceviewer.engine;
       
    20 
       
    21 import java.util.MissingResourceException;
       
    22 import java.util.ResourceBundle;
       
    23 
       
    24 /**
       
    25  * String localization for engine dataprocessor package.
       
    26  * 
       
    27  */
       
    28 final class Messages {
       
    29 
       
    30 	/**
       
    31 	 * Bundle name
       
    32 	 */
       
    33 	private static final String BUNDLE_NAME = "com.nokia.traceviewer.engine.messages"; //$NON-NLS-1$
       
    34 
       
    35 	/**
       
    36 	 * Resource bundle
       
    37 	 */
       
    38 	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
       
    39 			.getBundle(BUNDLE_NAME);
       
    40 
       
    41 	/**
       
    42 	 * Prevents construction.
       
    43 	 */
       
    44 	private Messages() {
       
    45 	}
       
    46 
       
    47 	/**
       
    48 	 * Maps a key to localized string.
       
    49 	 * 
       
    50 	 * @param key
       
    51 	 *            the key for the string
       
    52 	 * @return the localized string
       
    53 	 */
       
    54 	public static String getString(String key) {
       
    55 		String value;
       
    56 		try {
       
    57 			value = RESOURCE_BUNDLE.getString(key);
       
    58 		} catch (MissingResourceException e) {
       
    59 			value = '!' + key + '!';
       
    60 		}
       
    61 		return value;
       
    62 	}
       
    63 }