Java Code Examples for org.eclipse.core.runtime.Platform#getNL()

The following examples show how to use org.eclipse.core.runtime.Platform#getNL() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckstyleUIPlugin.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Helper method to get the current plattform locale.
 *
 * @return the platform locale
 */
public static Locale getPlatformLocale() {

  String nl = Platform.getNL();
  String[] parts = nl.split("_"); //$NON-NLS-1$

  String language = parts.length > 0 ? parts[0] : ""; //$NON-NLS-1$
  String country = parts.length > 1 ? parts[1] : ""; //$NON-NLS-1$
  String variant = parts.length > 2 ? parts[2] : ""; //$NON-NLS-1$

  return new Locale(language, country, variant);
}
 
Example 2
Source File: CheckstylePlugin.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Helper method to get the current plattform locale.
 *
 * @return the platform locale
 */
public static Locale getPlatformLocale() {

  String nl = Platform.getNL();
  String[] parts = nl.split("_"); //$NON-NLS-1$

  String language = parts.length > 0 ? parts[0] : ""; //$NON-NLS-1$
  String country = parts.length > 1 ? parts[1] : ""; //$NON-NLS-1$
  String variant = parts.length > 2 ? parts[2] : ""; //$NON-NLS-1$

  return new Locale(language, country, variant);
}
 
Example 3
Source File: SpellCheckEngine.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the current locale of the spelling preferences.
 *
 * @param store the preference store
 * @return The current locale of the spelling preferences
 */
private Locale getCurrentLocale() {
    String locale = PreferenceKeys.PKEY_SPELLING_LOCALE.getStoredValue();
    if (PreferenceConstants.PREF_VALUE_NO_LOCALE.equals(locale)) {
        locale = Platform.getNL();
    }
	return convertToLocale(locale);
}