mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Apply string replace for BTC, Bitcoin and bitcoin to selected base currency
This commit is contained in:
parent
0583b7a3cb
commit
ba3fcc2cd4
@ -55,6 +55,23 @@ public class Res {
|
||||
return StringUtils.capitalize(get(key)) + ":";
|
||||
}
|
||||
|
||||
public static ResourceBundle getResourceBundle() {
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
private static String baseCurrencyCode;
|
||||
private static String baseCurrencyName;
|
||||
private static String baseCurrencyNameLowerCase;
|
||||
|
||||
public static void setBaseCurrencyCode(String baseCurrencyCode) {
|
||||
Res.baseCurrencyCode = baseCurrencyCode;
|
||||
}
|
||||
|
||||
public static void setBaseCurrencyName(String baseCurrencyName) {
|
||||
Res.baseCurrencyName = baseCurrencyName;
|
||||
baseCurrencyNameLowerCase = baseCurrencyName.toLowerCase();
|
||||
}
|
||||
|
||||
// Capitalize first character
|
||||
public static String getWithCap(String key) {
|
||||
return StringUtils.capitalize(get(key));
|
||||
@ -64,12 +81,16 @@ public class Res {
|
||||
return get(key, arguments) + ":";
|
||||
}
|
||||
|
||||
public static String get(String key, Object... arguments) {
|
||||
return MessageFormat.format(Res.get(key), arguments);
|
||||
}
|
||||
|
||||
public static String get(String key) {
|
||||
// TODO remove once translation done
|
||||
// for testing missing translation strings
|
||||
//if (true) return "#";
|
||||
try {
|
||||
return resourceBundle.getString(key);
|
||||
return resourceBundle.getString(key)
|
||||
.replace("BTC", baseCurrencyCode)
|
||||
.replace("Bitcoin", baseCurrencyName)
|
||||
.replace("bitcoin", baseCurrencyNameLowerCase);
|
||||
} catch (MissingResourceException e) {
|
||||
log.warn("Missing resource for key: " + key);
|
||||
if (DevEnv.DEV_MODE)
|
||||
@ -78,14 +99,6 @@ public class Res {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
public static String get(String key, Object... arguments) {
|
||||
return MessageFormat.format(Res.get(key), arguments);
|
||||
}
|
||||
|
||||
public static ResourceBundle getResourceBundle() {
|
||||
return resourceBundle;
|
||||
}
|
||||
}
|
||||
|
||||
// Adds UTF8 support for property files
|
||||
|
@ -27,13 +27,13 @@ import org.libdohj.params.LitecoinRegTestParams;
|
||||
import org.libdohj.params.LitecoinTestNet3Params;
|
||||
|
||||
public enum BaseCurrencyNetwork {
|
||||
BTC_MAINNET(MainNetParams.get(), "BTC", "MAINNET"),
|
||||
BTC_TESTNET(TestNet3Params.get(), "BTC", "TESTNET"),
|
||||
BTC_REGTEST(RegTestParams.get(), "BTC", "REGTEST"),
|
||||
BTC_MAINNET(MainNetParams.get(), "BTC", "MAINNET", "Bitcoin"),
|
||||
BTC_TESTNET(TestNet3Params.get(), "BTC", "TESTNET", "Bitcoin"),
|
||||
BTC_REGTEST(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"),
|
||||
|
||||
LTC_MAINNET(LitecoinMainNetParams.get(), "LTC", "MAINNET"),
|
||||
LTC_TESTNET(LitecoinTestNet3Params.get(), "LTC", "TESTNET"),
|
||||
LTC_REGTEST(LitecoinRegTestParams.get(), "LTC", "REGTEST");
|
||||
LTC_MAINNET(LitecoinMainNetParams.get(), "LTC", "MAINNET", "Litecoin"),
|
||||
LTC_TESTNET(LitecoinTestNet3Params.get(), "LTC", "TESTNET", "Litecoin"),
|
||||
LTC_REGTEST(LitecoinRegTestParams.get(), "LTC", "REGTEST", "Litecoin");
|
||||
|
||||
public static final BaseCurrencyNetwork DEFAULT = LTC_MAINNET;
|
||||
|
||||
@ -43,10 +43,13 @@ public enum BaseCurrencyNetwork {
|
||||
private final String currency;
|
||||
@Getter
|
||||
private final String network;
|
||||
@Getter
|
||||
private String currencyName;
|
||||
|
||||
BaseCurrencyNetwork(NetworkParameters parameters, String currency, String network) {
|
||||
BaseCurrencyNetwork(NetworkParameters parameters, String currency, String network, String currencyName) {
|
||||
this.parameters = parameters;
|
||||
this.currency = currency;
|
||||
this.network = network;
|
||||
this.currencyName = currencyName;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import io.bisq.core.app.BisqEnvironment;
|
||||
import io.bisq.core.arbitration.ArbitratorManager;
|
||||
import io.bisq.core.arbitration.DisputeManager;
|
||||
import io.bisq.core.btc.AddressEntryList;
|
||||
import io.bisq.core.btc.BaseCurrencyNetwork;
|
||||
import io.bisq.core.btc.wallet.*;
|
||||
import io.bisq.core.dao.blockchain.json.JsonChainStateExporter;
|
||||
import io.bisq.core.dao.compensation.CompensationRequestManager;
|
||||
@ -85,7 +86,6 @@ import org.bitcoinj.store.BlockStoreException;
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.reactfx.EventStreams;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
@ -100,7 +100,7 @@ public class BisqApp extends Application {
|
||||
|
||||
private static final long LOG_MEMORY_PERIOD_MIN = 10;
|
||||
|
||||
private static Environment env;
|
||||
private static BisqEnvironment bisqEnvironment;
|
||||
|
||||
private BisqAppModule bisqAppModule;
|
||||
private Injector injector;
|
||||
@ -114,8 +114,8 @@ public class BisqApp extends Application {
|
||||
public static Runnable shutDownHandler;
|
||||
private boolean shutDownRequested;
|
||||
|
||||
public static void setEnvironment(Environment env) {
|
||||
BisqApp.env = env;
|
||||
public static void setEnvironment(BisqEnvironment bisqEnvironment) {
|
||||
BisqApp.bisqEnvironment = bisqEnvironment;
|
||||
}
|
||||
|
||||
@SuppressWarnings("PointlessBooleanExpression")
|
||||
@ -123,11 +123,11 @@ public class BisqApp extends Application {
|
||||
public void start(Stage stage) throws IOException {
|
||||
BisqApp.primaryStage = stage;
|
||||
|
||||
String logPath = Paths.get(env.getProperty(AppOptionKeys.APP_DATA_DIR_KEY), "bisq").toString();
|
||||
String logPath = Paths.get(bisqEnvironment.getProperty(AppOptionKeys.APP_DATA_DIR_KEY), "bisq").toString();
|
||||
Log.setup(logPath);
|
||||
log.info("Log files under: " + logPath);
|
||||
Utilities.printSysInfo();
|
||||
Log.setLevel(Level.toLevel(env.getRequiredProperty(CommonOptionKeys.LOG_LEVEL_KEY)));
|
||||
Log.setLevel(Level.toLevel(bisqEnvironment.getRequiredProperty(CommonOptionKeys.LOG_LEVEL_KEY)));
|
||||
|
||||
UserThread.setExecutor(Platform::runLater);
|
||||
UserThread.setTimerClass(UITimer.class);
|
||||
@ -164,9 +164,13 @@ public class BisqApp extends Application {
|
||||
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
|
||||
final BaseCurrencyNetwork baseCurrencyNetwork = bisqEnvironment.getBaseCurrencyNetwork();
|
||||
Res.setBaseCurrencyCode(baseCurrencyNetwork.getCurrency());
|
||||
Res.setBaseCurrencyName(baseCurrencyNetwork.getCurrencyName());
|
||||
|
||||
try {
|
||||
// Guice
|
||||
bisqAppModule = new BisqAppModule(env, primaryStage);
|
||||
bisqAppModule = new BisqAppModule(bisqEnvironment, primaryStage);
|
||||
injector = Guice.createInjector(bisqAppModule);
|
||||
injector.getInstance(InjectorViewFactory.class).setInjector(injector);
|
||||
/*
|
||||
@ -283,7 +287,7 @@ public class BisqApp extends Application {
|
||||
});
|
||||
|
||||
// configure the primary stage
|
||||
primaryStage.setTitle(env.getRequiredProperty(AppOptionKeys.APP_NAME_KEY));
|
||||
primaryStage.setTitle(bisqEnvironment.getRequiredProperty(AppOptionKeys.APP_NAME_KEY));
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.setMinWidth(1020);
|
||||
primaryStage.setMinHeight(620);
|
||||
|
Loading…
Reference in New Issue
Block a user