Java tutorial
//package com.java2s; /* * Copyright (C) 2009 Klaus Reimer <k@ailis.de> * See LICENSE.md for licensing information. */ import java.util.Locale; public class Main { /** * Prepares the locale. The language can be overridden with the specified environment variable. Set it to "de" to * enforce German language for example. The default is the system locale. * * @param overrideEnvVar * The environment variable to check for override value. Must not be null. */ public static void prepareLocale(final String overrideEnvVar) { final String language = System.getenv().get(overrideEnvVar); if (language != null) { Locale.setDefault(new Locale(language)); } } }