Localize exception messages

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Zachary Wander
2018-12-11 02:21:23 +01:00
committed by Jason A. Donenfeld
parent e1965f121c
commit 9de711a4f5
13 changed files with 92 additions and 35 deletions
@@ -24,6 +24,7 @@ import com.wireguard.config.ParseException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.Objects;
public class ConfigNamingDialogFragment extends DialogFragment {
@@ -68,7 +69,8 @@ public class ConfigNamingDialogFragment extends DialogFragment {
try {
config = Config.parse(new ByteArrayInputStream(getArguments().getString(KEY_CONFIG_TEXT).getBytes(StandardCharsets.UTF_8)));
} catch (final IOException | ParseException exception) {
throw new RuntimeException("Invalid config passed to " + getClass().getSimpleName(), exception);
throw new RuntimeException(String.format(Locale.getDefault(),
getResources().getString(R.string.invalid_config_error), getClass().getSimpleName()), exception);
}
}