tracesrv/tracecompiler/src/com.nokia.tracecompiler/src/com/nokia/tracecompiler/engine/header/Messages.java
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 /*
       
     2 * Copyright (c) 2007 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 * Localization for header package
       
    17 *
       
    18 */
       
    19 package com.nokia.tracecompiler.engine.header;
       
    20 
       
    21 import java.util.MissingResourceException;
       
    22 import java.util.ResourceBundle;
       
    23 
       
    24 /**
       
    25  * Localization for header package
       
    26  * 
       
    27  */
       
    28 class Messages {
       
    29 
       
    30 	/**
       
    31 	 * Bundle name
       
    32 	 */
       
    33 	private static final String BUNDLE_NAME = "com.nokia.tracecompiler.engine.header.messages"; //$NON-NLS-1$
       
    34 
       
    35 	/**
       
    36 	 * 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 	 * Gets localized string based on key
       
    49 	 * 
       
    50 	 * @param key
       
    51 	 *            the resource key
       
    52 	 * @return the localized resource
       
    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 }