Skip to main content
Sign in
Snippets Groups Projects
Verified Commit 7dc831bf authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Add TorStrings module for localization

Load some torlauncher strings to show in about:torconnect in
TorStrings.sys.mjs.

We could move them to torConnect.properties, but maybe we are still in
time for moving all of them to Fluent, so I preferred reducing the
number of migrations.

Also, remove unused strings from torlauncher.properties.
parent d783693d
Branches
Tags
1 merge request!968Draft: Bug 42479: Improve TorConnect error handling
......@@ -51,11 +51,11 @@ class TorPropertyStringBundle {
return `$(${key})`;
}
getStrings(strings) {
getStrings(strings, additionalPrefix = "") {
return Object.fromEntries(
Object.entries(strings).map(([key, fallback]) => [
key,
this.getString(key, fallback),
this.getString(additionalPrefix + key, fallback),
])
);
}
......@@ -143,7 +143,7 @@ const Loader = {
frequentLocations: "Frequently selected locations",
otherLocations: "Other locations",
// TorConnect.jsm error messages
// TorConnect error messages
offline: "Internet not reachable",
autoBootstrappingFailed: "Automatic configuration failed",
autoBootstrappingAllFailed: "None of the configurations we tried worked",
......@@ -158,11 +158,67 @@ const Loader = {
titlebarStatusConnected: "Connected",
};
// Some strings were used through TorLauncherUtils.
// However, we need to use them in about:torconnect, which cannot access
// privileged code.
const bootstrapStatus = {
starting: "Starting",
conn_pt: "Connecting to bridge",
conn_done_pt: "Connected to bridge",
conn_proxy: "Connecting to proxy",
conn_done_proxy: "Connected to proxy",
conn: "Connecting to a Tor relay",
conn_done: "Connected to a Tor relay",
handshake: "Negotiating with a Tor relay",
handshake_done: "Finished negotiating with a Tor relay",
onehop_create: "Establishing an encrypted directory connection",
requesting_status: "Retrieving network status",
loading_status: "Loading network status",
loading_keys: "Loading authority certificates",
requesting_descriptors: "Requesting relay information",
loading_descriptors: "Loading relay information",
enough_dirinfo: "Finished loading relay information",
ap_conn_pt: "Building circuits: Connecting to bridge",
ap_conn_done_pt: "Building circuits: Connected to bridge",
ap_conn_proxy: "Building circuits: Connecting to proxy",
ap_conn_done_proxy: "Building circuits: Connected to proxy",
ap_conn: "Building circuits: Connecting to a Tor relay",
ap_conn_done: "Building circuits: Connected to a Tor relay",
ap_handshake: "Building circuits: Negotiating with a Tor relay",
ap_handshake_done:
"Building circuits: Finished negotiating with a Tor relay",
circuit_create: "Building circuits: Establishing a Tor circuit",
done: "Connected to the Tor network!",
};
const bootstrapWarning = {
done: "done",
connectrefused: "connection refused",
misc: "miscellaneous",
resourcelimit: "insufficient resources",
identity: "identity mismatch",
timeout: "connection timeout",
noroute: "no route to host",
ioerror: "read/write error",
pt_missing: "missing pluggable transport",
};
const tsb = new TorPropertyStringBundle(
"chrome://torbutton/locale/torConnect.properties",
"torConnect."
);
return tsb.getStrings(strings);
const tlsb = new TorPropertyStringBundle(
"chrome://torbutton/locale/torlauncher.properties",
"torlauncher."
);
return {
...tsb.getStrings(strings),
bootstrapFailedDetails: tlsb.getString(
"tor_bootstrap_failed_details",
"%1$S failed (%2$S)."
),
bootstrapStatus: tlsb.getStrings(bootstrapStatus, "bootstrapStatus."),
bootstrapWarning: tlsb.getStrings(bootstrapWarning, "bootstrapWarning."),
};
},
/*
......
......
......@@ -4,20 +4,19 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
torlauncher.error_title=Tor Launcher
torlauncher.tor_exited_during_startup=Tor exited during startup. This might be due to an error in your torrc file, a bug in Tor or another program on your system, or faulty hardware. Until you fix the underlying problem and restart Tor, Tor Browser will not start.
torlauncher.tor_exited=Tor unexpectedly exited. This might be due to a bug in Tor itself, another program on your system, or faulty hardware. Until you restart Tor, Tor Browser will not be able to reach any websites. If the problem persists, please send a copy of your Tor Log to the support team.
torlauncher.tor_exited2=Restarting Tor will not close your browser tabs.
torlauncher.restart_tor=Restart Tor
torlauncher.tor_bootstrap_failed=Tor failed to establish a Tor network connection.
torlauncher.tor_bootstrap_failed_details=%1$S failed (%2$S).
torlauncher.unable_to_start_tor=Unable to start Tor.\n\n%S
torlauncher.tor_missing=The Tor executable is missing.
torlauncher.torrc_missing=The torrc file is missing and could not be created.
torlauncher.datadir_missing=The Tor data directory does not exist and could not be created.
torlauncher.onionauthdir_missing=The Tor onion authentication directory does not exist and could not be created.
torlauncher.password_hash_missing=Failed to get hashed password.
# Translation note: %1$S is a bootstrap phase from torlauncher.bootstrapStatus,
# %2$S is the error from torlauncher.bootstrapWarning
torlauncher.tor_bootstrap_failed_details=%1$S failed (%2$S).
torlauncher.bootstrapStatus.starting=Starting
torlauncher.bootstrapStatus.conn_pt=Connecting to bridge
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment