From 4a702f8ccaa1180f70cb509f94b15bef221ac55a Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 5 May 2010 03:47:30 +0000 Subject: [PATCH] [2856097] The "Enter new Location/Address" countries are not translate - refactor to avoid static variable Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2856097 --- base/src/org/compiere/model/MCountry.java | 21 +++++++++++++++---- .../org/compiere/grid/ed/VLocationDialog.java | 1 - .../webui/window/WLocationDialog.java | 1 - 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/base/src/org/compiere/model/MCountry.java b/base/src/org/compiere/model/MCountry.java index ac474c958a..65d186dd3c 100644 --- a/base/src/org/compiere/model/MCountry.java +++ b/base/src/org/compiere/model/MCountry.java @@ -28,6 +28,7 @@ import java.util.logging.Level; import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.DB; +import org.compiere.util.Env; import org.compiere.util.Language; /** @@ -139,9 +140,21 @@ public final class MCountry extends X_C_Country + " - Default=" + s_default); } // loadAllCountries + /** + * Return Language + * @return Name + */ + private String getEnvLanguage() { + String lang = Env.getAD_Language(Env.getCtx()); + if (Language.isBaseLanguage(lang)) + return null; + return lang; + } + /** * Set the Language for Display (toString) * @param AD_Language language or null + * @deprecated - not used at all, you can delete references to this method */ public static void setDisplayLanguage (String AD_Language) { @@ -204,7 +217,7 @@ public final class MCountry extends X_C_Country */ public String toString() { - if (s_AD_Language != null) + if (getEnvLanguage() != null) { String nn = getTrlName(); if (nn != null) @@ -219,11 +232,11 @@ public final class MCountry extends X_C_Country */ public String getTrlName() { - if (m_trlName == null && s_AD_Language != null) + if (m_trlName == null && getEnvLanguage() != null) { - m_trlName = get_Translation(COLUMNNAME_Name, s_AD_Language); + m_trlName = get_Translation(COLUMNNAME_Name, getEnvLanguage()); if (m_trlName == null) - s_AD_Language = null; // assume that there is no translation + m_trlName = getName(); } return m_trlName; } // getTrlName diff --git a/client/src/org/compiere/grid/ed/VLocationDialog.java b/client/src/org/compiere/grid/ed/VLocationDialog.java index 60f3a78e81..0f050b12de 100644 --- a/client/src/org/compiere/grid/ed/VLocationDialog.java +++ b/client/src/org/compiere/grid/ed/VLocationDialog.java @@ -113,7 +113,6 @@ public class VLocationDialog extends CDialog Env.setContext(Env.getCtx(), m_WindowNo, Env.TAB_INFO, "C_Country_ID", null); // Current Country - MCountry.setDisplayLanguage(Env.getAD_Language(Env.getCtx())); fCountry = new CComboBox(MCountry.getCountries(Env.getCtx())); fCountry.setSelectedItem(m_location.getCountry()); m_origCountry_ID = m_location.getC_Country_ID(); diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java index 2c30fd422f..8b03370fbc 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/WLocationDialog.java @@ -131,7 +131,6 @@ public class WLocationDialog extends Window implements EventListener initComponents(); init(); // Current Country - MCountry.setDisplayLanguage(Env.getAD_Language(Env.getCtx())); for (MCountry country:MCountry.getCountries(Env.getCtx())) { lstCountry.appendItem(country.toString(), country);