Archived
0

- change items id

- add support localization for item name
- change station name for support EMDN
This commit is contained in:
iMoHax
2014-08-28 21:47:06 +04:00
parent 98c6df4546
commit 5db40e1a4f
6 changed files with 1860 additions and 1702 deletions

View File

@@ -232,8 +232,8 @@ public class VendorEditorController {
ItemData data = emdnData.getData(offer.item.getId());
LOG.debug("Update item {} to {}", offer.item.getName(), data);
if (data != null){
offer.setBprice(data.getBuy());
offer.setSprice(data.getSell());
offer.setSprice(data.getBuy());
offer.setBprice(data.getSell());
}
}
}

View File

@@ -6,6 +6,7 @@ import javafx.beans.property.StringProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.trader.core.Item;
import ru.trader.view.support.Localization;
public class ItemModel{
private final static Logger LOG = LoggerFactory.getLogger(ItemModel.class);
@@ -30,7 +31,8 @@ public class ItemModel{
public ReadOnlyStringProperty nameProperty() {
if (name == null) {
name = new SimpleStringProperty(item.getName());
String lName = Localization.getString("item."+item.getName(), item.getName());
name = new SimpleStringProperty(lName);
}
return name;
}

View File

@@ -6,10 +6,7 @@ import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.*;
public class Localization {
private static final Locale DEFAULT = new Locale("ru", "RU");
@@ -69,6 +66,14 @@ public class Localization {
return rb.getString(key);
}
public static String getString(String key, String def){
try {
return rb.getString(key);
} catch (MissingResourceException e){
return def;
}
}
public static Locale getCurrentLocale() {
return locale;
}