- change items id
- add support localization for item name - change station name for support EMDN
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user