Replaced hard-coded strings with localizable strings

Added en locale as localization fallback
This commit is contained in:
Alec Ananian
2020-01-14 07:43:41 -08:00
parent 119eb321ec
commit 8690d18695
23 changed files with 452 additions and 298 deletions

View File

@@ -1,10 +1,10 @@
<template>
<div class="page">
<pw-section class="blue" label="Collections" ref="collections">
<pw-section class="blue" :label="$t('collections')" ref="collections">
<ul>
<li>
<p class="info">
Import any Postwoman Collection to Generate Documentation on-the-go.
{{ $t("generate_docs_message") }}
</p>
</li>
</ul>
@@ -14,10 +14,10 @@
<button
class="icon"
@click="$refs.collectionUpload.click()"
v-tooltip="'JSON'"
v-tooltip="$t('json')"
>
<i class="material-icons">folder</i>
<span>Import collections</span>
<span>{{ $t("import_collections") }}</span>
</button>
</label>
<input
@@ -48,7 +48,7 @@
<li>
<button class="icon" @click="getDoc">
<i class="material-icons">book</i>
<span>Generate Documentation</span>
<span>{{ $t("generate_docs") }}</span>
</button>
</li>
</ul>
@@ -56,7 +56,7 @@
<pw-section class="green" label="Documentation" ref="documentation">
<p v-if="this.items.length === 0" class="info">
Generate documentation first
{{ $t("generate_docs_first") }}
</p>
<div>
<span
@@ -66,7 +66,7 @@
>
<h2>
<i class="material-icons">folder</i>
{{ collection.name || "None" }}
{{ collection.name || $t("none") }}
</h2>
<span
class="folder"
@@ -75,7 +75,7 @@
>
<h3>
<i class="material-icons">folder_open</i>
{{ folder.name || "None" }}
{{ folder.name || $t("none") }}
</h3>
<span
class="request"
@@ -84,46 +84,46 @@
>
<h4>
<i class="material-icons">insert_drive_file</i>
{{ request.name || "None" }}
{{ request.name || $t("none") }}
</h4>
<p class="doc-desc" v-if="request.url">
<span>
URL: <code>{{ request.url || "None" }}</code>
{{ $t("url") }}: <code>{{ request.url || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.path">
<span>
Path: <code>{{ request.path || "None" }}</code>
{{ $t("path") }}: <code>{{ request.path || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.method">
<span>
Method: <code>{{ request.method || "None" }}</code>
{{ $t("method") }}: <code>{{ request.method || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.auth">
<span>
Authentication:
<code>{{ request.auth || "None" }}</code>
{{ $t("authentication") }}:
<code>{{ request.auth || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.httpUser">
<span>
Username: <code>{{ request.httpUser || "None" }}</code>
{{ $t("username") }}: <code>{{ request.httpUser || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.httpPassword">
<span>
Password:
<code>{{ request.httpPassword || "None" }}</code>
{{ $t("password") }}:
<code>{{ request.httpPassword || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.bearerToken">
<span>
Token: <code>{{ request.bearerToken || "None" }}</code>
{{ $t("token") }}: <code>{{ request.bearerToken || $t("none") }}</code>
</span>
</p>
<h4 v-if="request.headers.length > 0">Headers</h4>
<h4 v-if="request.headers.length > 0">{{ $t("headers") }}</h4>
<span
v-if="request.headers"
v-for="header in request.headers"
@@ -131,12 +131,12 @@
>
<p class="doc-desc">
<span>
{{ header.key || "None" }}:
<code>{{ header.value || "None" }}</code>
{{ header.key || $t("none") }}:
<code>{{ header.value || $t("none") }}</code>
</span>
</p>
</span>
<h4 v-if="request.params.length > 0">Parameters</h4>
<h4 v-if="request.params.length > 0">{{ $t("parameters") }}</h4>
<span
v-if="request.params"
v-for="parameter in request.params"
@@ -144,12 +144,12 @@
>
<p class="doc-desc">
<span>
{{ parameter.key || "None" }}:
<code>{{ parameter.value || "None" }}</code>
{{ parameter.key || $t("none") }}:
<code>{{ parameter.value || $t("none") }}</code>
</span>
</p>
</span>
<h4 v-if="request.bodyParam">Payload</h4>
<h4 v-if="request.bodyParam">{{ $t("payload") }}</h4>
<span
v-if="request.bodyParam"
v-for="payload in request.bodyParam"
@@ -157,26 +157,26 @@
>
<p class="doc-desc">
<span>
{{ payload.key || "None" }}:
<code>{{ payload.value || "None" }}</code>
{{ payload.key || $t("none") }}:
<code>{{ payload.value || $t("none") }}</code>
</span>
</p>
</span>
<p class="doc-desc" v-if="request.rawParams">
<span>
Parameters: <code>{{ request.rawParams || "None" }}</code>
{{ $t("parameters") }}: <code>{{ request.rawParams || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.contentType">
<span>
Content Type:
<code>{{ request.contentType || "None" }}</code>
{{ $t("content_type") }}:
<code>{{ request.contentType || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.requestType">
<span>
Request Type:
<code>{{ request.requestType || "None" }}</code>
{{ $t("request_type") }}:
<code>{{ request.requestType || $t("none") }}</code>
</span>
</p>
</span>
@@ -188,45 +188,45 @@
>
<h4>
<i class="material-icons">insert_drive_file</i>
{{ request.name || "None" }}
{{ request.name || $t("none") }}
</h4>
<p class="doc-desc" v-if="request.url">
<span>
URL: <code>{{ request.url || "None" }}</code>
{{ $t("url") }}: <code>{{ request.url || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.path">
<span>
Path: <code>{{ request.path || "None" }}</code>
{{ $t("path") }}: <code>{{ request.path || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.method">
<span>
Method: <code>{{ request.method || "None" }}</code>
{{ $t("method") }}: <code>{{ request.method || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.auth">
<span>
Authentication:
<code>{{ request.auth || "None" }}</code>
{{ $t("authentication") }}:
<code>{{ request.auth || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.httpUser">
<span>
Username: <code>{{ request.httpUser || "None" }}</code>
{{ $t("username") }}: <code>{{ request.httpUser || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.httpPassword">
<span>
Password: <code>{{ request.httpPassword || "None" }}</code>
{{ $t("password") }}: <code>{{ request.httpPassword || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.bearerToken">
<span>
Token: <code>{{ request.bearerToken || "None" }}</code>
{{ $t("token") }}: <code>{{ request.bearerToken || $t("none") }}</code>
</span>
</p>
<h4 v-if="request.headers.length > 0">Headers</h4>
<h4 v-if="request.headers.length > 0">{{ $t("headers") }}</h4>
<span
v-if="request.headers"
v-for="header in request.headers"
@@ -234,12 +234,12 @@
>
<p class="doc-desc">
<span>
{{ header.key || "None" }}:
<code>{{ header.value || "None" }}</code>
{{ header.key || $t("none") }}:
<code>{{ header.value || $t("none") }}</code>
</span>
</p>
</span>
<h4 v-if="request.params.length > 0">Parameters</h4>
<h4 v-if="request.params.length > 0">{{ $t("parameters") }}</h4>
<span
v-if="request.params"
v-for="parameter in request.params"
@@ -247,12 +247,12 @@
>
<p class="doc-desc">
<span>
{{ parameter.key || "None" }}:
<code>{{ parameter.value || "None" }}</code>
{{ parameter.key || $t("none") }}:
<code>{{ parameter.value || $t("none") }}</code>
</span>
</p>
</span>
<h4 v-if="request.bodyParam">Payload</h4>
<h4 v-if="request.bodyParam">{{ $t("payload") }}</h4>
<span
v-if="request.bodyParam"
v-for="payload in request.bodyParam"
@@ -260,26 +260,26 @@
>
<p class="doc-desc">
<span>
{{ payload.key || "None" }}:
<code>{{ payload.value || "None" }}</code>
{{ payload.key || $t("none") }}:
<code>{{ payload.value || $t("none") }}</code>
</span>
</p>
</span>
<p class="doc-desc" v-if="request.rawParams">
<span>
Parameters: <code>{{ request.rawParams || "None" }}</code>
{{ $t("parameters") }}: <code>{{ request.rawParams || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.contentType">
<span>
Content Type:
<code>{{ request.contentType || "None" }}</code>
{{ $t("content_type") }}:
<code>{{ request.contentType || $t("none") }}</code>
</span>
</p>
<p class="doc-desc" v-if="request.requestType">
<span>
Request Type:
<code>{{ request.requestType || "None" }}</code>
{{ $t("request_type") }}:
<code>{{ request.requestType || $t("none") }}</code>
</span>
</p>
</span>
@@ -360,11 +360,11 @@ export default {
this.collectionJSON = e.target.result;
};
reader.readAsText(file);
this.$toast.info("File imported", {
this.$toast.info(this.$t("file_imported"), {
icon: "attach_file"
});
} else {
this.$toast.error("Choose a file", {
this.$toast.error(this.$t("choose_file"), {
icon: "attach_file"
});
}
@@ -373,7 +373,7 @@ export default {
getDoc() {
try {
this.items = JSON.parse(this.collectionJSON);
this.$toast.info("Documentation generated", {
this.$toast.info(this.$t("docs_generated"), {
icon: "book"
});
} catch (e) {

View File

@@ -2,7 +2,7 @@
<div class="page">
<div class="content">
<div class="page-columns inner-left">
<pw-section class="blue" label="Endpoint" ref="endpoint">
<pw-section class="blue" :label="$t('endpoint')" ref="endpoint">
<ul>
<li>
<label for="url">{{ $t("url") }}</label>
@@ -25,7 +25,7 @@
</ul>
</pw-section>
<pw-section class="orange" label="Headers" ref="headers">
<pw-section class="orange" :label="$t('headers')" ref="headers">
<ul>
<li>
<div class="flex-wrap">
@@ -34,7 +34,7 @@
<button
class="icon"
@click="headers = []"
v-tooltip.bottom="'Clear'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
@@ -45,7 +45,7 @@
readonly
v-textarea-auto-height="headerString"
v-model="headerString"
placeholder="(add at least one header)"
:placeholder="$t('add_one_header')"
rows="1"
></textarea>
</li>
@@ -53,7 +53,7 @@
<ul v-for="(header, index) in headers" :key="index">
<li>
<autocomplete
:placeholder="'header ' + (index + 1)"
:placeholder="$t('header_count', { count: index + 1 })"
:source="commonHeaders"
:spellcheck="false"
:value="header.key"
@@ -68,7 +68,7 @@
</li>
<li>
<input
:placeholder="'value ' + (index + 1)"
:placeholder="$t('value_count', { count: index + 1 })"
:name="'value' + index"
:value="header.value"
@change="
@@ -85,6 +85,7 @@
<button
class="icon"
@click="removeRequestHeader(index)"
v-tooltip.bottom="$t('delete')"
id="header"
>
<i class="material-icons">delete</i>
@@ -102,7 +103,7 @@
</ul>
</pw-section>
<pw-section class="green" label="Schema" ref="schema">
<pw-section class="green" :label="$t('schema')" ref="schema">
<div class="flex-wrap">
<label>{{ $t("response") }}</label>
<div>
@@ -112,8 +113,8 @@
ref="ToggleExpandResponse"
v-tooltip="{
content: !expandResponse
? 'Expand response'
: 'Collapse response'
? $t('expand_response')
: $t('collapse_response')
}"
>
<i class="material-icons">
@@ -124,7 +125,7 @@
class="icon"
@click="downloadResponse"
ref="downloadResponse"
v-tooltip="'Download file'"
v-tooltip="$t('download_file')"
>
<i class="material-icons">get_app</i>
</button>
@@ -132,7 +133,7 @@
class="icon"
ref="copySchemaCode"
@click="copySchema"
v-tooltip="'Copy Schema'"
v-tooltip="$t('copy_schema')"
>
<i class="material-icons">file_copy</i>
</button>
@@ -153,14 +154,14 @@
/>
</pw-section>
<pw-section class="cyan" label="Query" ref="query">
<pw-section class="cyan" :label="$t('query')" ref="query">
<div class="flex-wrap">
<label for="gqlQuery">{{ $t("query") }}</label>
<div>
<button
class="icon"
@click="runQuery()"
v-tooltip.bottom="'Run Query'"
v-tooltip.bottom="$t('run_query')"
>
<i class="material-icons">play_arrow</i>
</button>
@@ -168,7 +169,7 @@
class="icon"
@click="copyQuery"
ref="copyQueryButton"
v-tooltip="'Copy Query'"
v-tooltip="$t('copy_query')"
>
<i class="material-icons">file_copy</i>
</button>
@@ -191,7 +192,7 @@
<button
class="icon"
@click="variables = []"
v-tooltip.bottom="'Clear'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
@@ -200,7 +201,7 @@
<ul v-for="(variable, index) in variables" :key="index">
<li>
<input
:placeholder="'variable ' + (index + 1)"
:placeholder="$t('variable_count', { count: index + 1 })"
:name="'variable_key_' + index"
:value="variable.key"
@change="
@@ -214,7 +215,7 @@
</li>
<li>
<input
:placeholder="'value ' + (index + 1)"
:placeholder="$t('value_count', { count: index + 1 })"
:name="'variable_value_' + index"
:value="variable.value"
@change="
@@ -228,7 +229,11 @@
</li>
<div>
<li>
<button class="icon" @click="removeQueryVariable(index)">
<button
class="icon"
@click="removeQueryVariable(index)"
v-tooltip.bottom="$t('delete')"
>
<i class="material-icons">delete</i>
</button>
</li>
@@ -252,7 +257,7 @@
class="icon"
@click="copyResponse"
ref="copyResponseButton"
v-tooltip="'Copy Response'"
v-tooltip="$t('copy_response')"
>
<i class="material-icons">file_copy</i>
</button>
@@ -274,7 +279,7 @@
</pw-section>
</div>
<aside class="sticky-inner inner-right">
<pw-section class="purple" label="Docs" ref="docs">
<pw-section class="purple" :label="$t('docs')" ref="docs">
<section>
<input
v-if="queryFields.length > 0"
@@ -366,7 +371,7 @@
"
class="info"
>
Send a request first
{{ $t("send_request_first") }}
</p>
</pw-section>
</aside>
@@ -605,7 +610,7 @@ export default {
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
this.$toast.success("Copied to clipboard", {
this.$toast.success(this.$t("copied_to_clipboard"), {
icon: "done"
});
setTimeout(
@@ -621,7 +626,7 @@ export default {
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
this.$toast.success("Copied to clipboard", {
this.$toast.success(this.$t("copied_to_clipboard"), {
icon: "done"
});
setTimeout(
@@ -637,7 +642,7 @@ export default {
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
this.$toast.success("Copied to clipboard", {
this.$toast.success(this.$t("copied_to_clipboard"), {
icon: "done"
});
setTimeout(
@@ -705,13 +710,13 @@ export default {
this.$nuxt.$loading.finish();
const duration = Date.now() - startTime;
this.$toast.info(`Finished in ${duration}ms`, {
this.$toast.info(this.$t("finished_in", { duration }), {
icon: "done"
});
} catch (error) {
this.$nuxt.$loading.finish();
this.$toast.error(error + " (F12 for details)", {
this.$toast.error(`${error} ${this.$t("f12_details")}`, {
icon: "error"
});
console.log("Error", error);
@@ -719,7 +724,7 @@ export default {
},
async getSchema() {
const startTime = Date.now();
this.schemaString = "Loading...";
this.schemaString = this.$t("loading");
this.scrollInto("schema");
// Start showing the loading bar as soon as possible.
@@ -824,13 +829,13 @@ export default {
this.$nuxt.$loading.finish();
const duration = Date.now() - startTime;
this.$toast.info(`Finished in ${duration}ms`, {
this.$toast.info(this.$t("finished_in", { duration }), {
icon: "done"
});
} catch (error) {
this.$nuxt.$loading.finish();
this.schemaString = error + ". Check console for details.";
this.$toast.error(error + " (F12 for details)", {
this.schemaString = `${error}. ${check_console_details}`;
this.$toast.error(`${error} ${this.$t("f12_details")}`, {
icon: "error"
});
console.log("Error", error);
@@ -854,7 +859,7 @@ export default {
document.body.appendChild(a);
a.click();
this.$refs.downloadResponse.innerHTML = this.doneButton;
this.$toast.success("Download started", {
this.$toast.success(this.$t("download_started"), {
icon: "done"
});
setTimeout(() => {
@@ -875,10 +880,10 @@ export default {
const oldHeaders = this.headers.slice();
this.$store.commit("removeGQLHeader", index);
this.$toast.error("Deleted", {
this.$toast.error(this.$t("deleted"), {
icon: "delete",
action: {
text: "Undo",
text: this.$t("undo"),
duration: 4000,
onClick: (e, toastObject) => {
this.headers = oldHeaders;
@@ -899,10 +904,10 @@ export default {
const oldVariables = this.variables.slice();
this.$store.commit("removeGQLVariable", index);
this.$toast.error("Deleted", {
this.$toast.error(this.$t("deleted"), {
icon: "delete",
action: {
text: "Undo",
text: this.$t("undo"),
duration: 4000,
onClick: (e, toastObject) => {
this.variables = oldVariables;

View File

@@ -18,7 +18,7 @@
target="_blank"
rel="noopener"
>
<button class="icon" v-tooltip="'Wiki'">
<button class="icon" v-tooltip="$t('wiki')">
<i class="material-icons">help</i>
</button>
</a>
@@ -40,7 +40,11 @@
</ul>
</pw-section>
<pw-section class="blue" label="Request" ref="request">
<pw-section
class="blue"
:label="$t('request')"
ref="request"
>
<ul>
<li>
<label for="method">{{ $t("method") }}</label>
@@ -86,7 +90,7 @@
name="label"
type="text"
v-model="label"
placeholder="(optional)"
:placeholder="$t('optional')"
/>
</li>
<li>
@@ -135,7 +139,7 @@
<button
class="icon"
@click="$refs.payload.click()"
v-tooltip="'Upload file'"
v-tooltip="$t('upload_file')"
>
<i class="material-icons">attach_file</i>
</button>
@@ -159,7 +163,7 @@
readonly
v-textarea-auto-height="rawRequestBody"
v-model="rawRequestBody"
placeholder="(add at least one parameter)"
:placeholder="$t('add_one_parameter')"
rows="1"
></textarea>
</li>
@@ -200,6 +204,7 @@
<button
class="icon"
@click="removeRequestBodyParam(index)"
v-tooltip.bottom="$t('delete')"
id="delParam"
>
<i class="material-icons">delete</i>
@@ -306,7 +311,7 @@
<button
class="icon"
@click="clearContent('', $event)"
v-tooltip.bottom="'Clear All'"
v-tooltip.bottom="$t('clear_all')"
ref="clearAll"
>
<i class="material-icons">clear_all</i>
@@ -321,7 +326,7 @@
<div class="tab">
<pw-section
class="cyan"
label="Authentication"
:label="$t('authentication')"
ref="authentication"
>
<ul>
@@ -332,7 +337,7 @@
<button
class="icon"
@click="clearContent('auth', $event)"
v-tooltip.bottom="'Clear'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
@@ -443,14 +448,14 @@
<button
class="icon"
@click="clearContent('access_token', $event)"
v-tooltip.bottom="'Clear'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
<button
class="icon"
@click="showTokenRequest = false"
v-tooltip.bottom="'Close'"
v-tooltip.bottom="$t('close')"
>
<i class="material-icons">close</i>
</button>
@@ -458,7 +463,7 @@
</div>
<input
id="token-name"
placeholder="(optional)"
:placeholder="$t('optional')"
name="token_name"
v-model="accessTokenName"
type="text"
@@ -556,7 +561,7 @@
<button
class="icon"
@click="clearContent('headers', $event)"
v-tooltip.bottom="'Clear'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
@@ -567,7 +572,7 @@
readonly
v-textarea-auto-height="headerString"
v-model="headerString"
placeholder="(add at least one header)"
:placeholder="$t('add_one_header')"
rows="1"
></textarea>
</li>
@@ -575,7 +580,7 @@
<ul v-for="(header, index) in headers" :key="index">
<li>
<autocomplete
:placeholder="'header ' + (index + 1)"
:placeholder="$t('header_count', { count: index + 1 })"
:source="commonHeaders"
:spellcheck="false"
:value="header.key"
@@ -591,7 +596,7 @@
</li>
<li>
<input
:placeholder="'value ' + (index + 1)"
:placeholder="$t('value_count', { count: index + 1 })"
:name="'value' + index"
:value="header.value"
@change="
@@ -608,6 +613,7 @@
<button
class="icon"
@click="removeRequestHeader(index)"
v-tooltip.bottom="$t('delete')"
id="header"
>
<i class="material-icons">delete</i>
@@ -637,7 +643,7 @@
<button
class="icon"
@click="clearContent('parameters', $event)"
v-tooltip.bottom="'Clear'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
@@ -648,7 +654,7 @@
readonly
v-textarea-auto-height="queryString"
v-model="queryString"
placeholder="(add at least one parameter)"
:placeholder="$t('add_one_parameter')"
rows="1"
></textarea>
</li>
@@ -656,7 +662,7 @@
<ul v-for="(param, index) in params" :key="index">
<li>
<input
:placeholder="'parameter ' + (index + 1)"
:placeholder="$t('parameter_count', { count: index + 1 })"
:name="'param' + index"
:value="param.key"
@change="
@@ -670,7 +676,7 @@
</li>
<li>
<input
:placeholder="'value ' + (index + 1)"
:placeholder="$t('value_count', { count: index + 1 })"
:name="'value' + index"
:value="param.value"
@change="
@@ -686,6 +692,7 @@
<button
class="icon"
@click="removeRequestParam(index)"
v-tooltip.bottom="$t('delete')"
id="param"
>
<i class="material-icons">delete</i>
@@ -722,7 +729,7 @@
<pw-section
class="purple"
id="response"
label="Response"
:label="$t('response')"
ref="response"
>
<ul>
@@ -730,7 +737,7 @@
<label for="status">{{ $t("status") }}</label>
<input
:class="statusCategory ? statusCategory.className : ''"
:value="response.status || '(waiting to send request)'"
:value="response.status || $t('waiting_send_req')"
ref="status"
id="status"
name="status"
@@ -770,7 +777,7 @@
@click="downloadResponse"
ref="downloadResponse"
v-if="response.body"
v-tooltip="'Download file'"
v-tooltip="$t('download_file')"
>
<i class="material-icons">get_app</i>
</button>
@@ -779,7 +786,7 @@
@click="copyResponse"
ref="copyResponse"
v-if="response.body"
v-tooltip="'Copy response'"
v-tooltip="$t('copy_response')"
>
<i class="material-icons">file_copy</i>
</button>
@@ -835,7 +842,7 @@
<input id="collection-tab" type="radio" name="side" />
<label for="collection-tab">{{ $t("collections") }}</label>
<div class="tab">
<pw-section class="yellow" label="Collections" ref="collections">
<pw-section class="yellow" :label="$t('collections')" ref="collections">
<collections />
</pw-section>
</div>
@@ -870,7 +877,7 @@
id="import-text"
autofocus
rows="8"
placeholder="Enter cURL"
:placeholder="$t('enter_curl')"
></textarea>
</li>
</ul>
@@ -880,7 +887,7 @@
<span></span>
<span>
<button class="icon" @click="showModal = false">
Cancel
{{ $t("cancel") }}
</button>
<button class="icon primary" @click="handleImport">
{{ $t("import") }}
@@ -928,7 +935,7 @@
@click="copyRequestCode"
id="copyRequestCode"
ref="copyRequestCode"
v-tooltip="'Copy code'"
v-tooltip="$t('copy_code')"
>
<i class="material-icons">file_copy</i>
</button>
@@ -971,7 +978,7 @@
<button
class="icon"
@click="clearContent('tokens', $event)"
v-tooltip.bottom="'Clear'"
v-tooltip.bottom="$t('clear')"
>
<i class="material-icons">clear_all</i>
</button>
@@ -1009,7 +1016,7 @@
<button
class="icon"
@click="removeOAuthToken(index)"
v-tooltip.bottom="'Delete'"
v-tooltip.bottom="$t('delete')"
>
<i class="material-icons">delete</i>
</button>
@@ -1017,7 +1024,7 @@
</div>
</ul>
<p v-if="tokens.length === 0" class="info">
Empty
{{ $t("empty") }}
</p>
</div>
<div slot="footer"></div>
@@ -1059,7 +1066,7 @@
:disabled="this.tokenReqs.length === 0"
class="icon"
@click="removeOAuthTokenReq"
v-tooltip.bottom="'Delete'"
v-tooltip.bottom="$t('delete')"
>
<i class="material-icons">delete</i>
</button>
@@ -1389,8 +1396,8 @@ export default {
},
"response.body": function(val) {
if (
this.response.body === "(waiting to send request)" ||
this.response.body === "Loading..."
this.response.body === this.$t("waiting_send_req") ||
this.response.body === this.$t("loading")
) {
this.responseBodyText = this.response.body;
this.responseBodyType = "text";
@@ -2005,7 +2012,7 @@ export default {
this.scrollInto("response");
if (!this.isValidURL) {
this.$toast.error("URL is not formatted properly", {
this.$toast.error(this.$t("url_invalid_format"), {
icon: "error"
});
return;
@@ -2019,8 +2026,8 @@ export default {
this.$refs.response.$el.classList.toggle("hidden");
}
this.previewEnabled = false;
this.response.status = "Fetching...";
this.response.body = "Loading...";
this.response.status = this.$t("fetching");
this.response.body = this.$t("loading");
const auth =
this.auth === "Basic Auth"
@@ -2081,7 +2088,7 @@ export default {
);
const duration = Date.now() - startTime;
this.$toast.info(`Finished in ${duration}ms`, {
this.$toast.info(this.$t("finished_in", { duration }), {
icon: "done"
});
@@ -2134,12 +2141,12 @@ export default {
return;
} else {
this.response.status = error.message;
this.response.body = error + ". Check console for details.";
this.$toast.error(error + " (F12 for details)", {
this.response.body = `${error}. ${this.$t("check_console_details")}`;
this.$toast.error(`${error} ${this.$t("f12_details")}`, {
icon: "error"
});
if (!this.$store.state.postwoman.settings.PROXY_ENABLED) {
this.$toast.info("Try enabling Proxy", {
this.$toast.info(this.$t("enable_proxy"), {
icon: "help",
duration: 8000,
action: {
@@ -2184,10 +2191,10 @@ export default {
const oldHeaders = this.headers.slice();
this.$store.commit("removeHeaders", index);
this.$toast.error("Deleted", {
this.$toast.error(this.$t("deleted"), {
icon: "delete",
action: {
text: "Undo",
text: this.$t("undo"),
onClick: (e, toastObject) => {
this.headers = oldHeaders;
toastObject.remove();
@@ -2204,10 +2211,10 @@ export default {
const oldParams = this.params.slice();
this.$store.commit("removeParams", index);
this.$toast.error("Deleted", {
this.$toast.error(this.$t("deleted"), {
icon: "delete",
action: {
text: "Undo",
text: this.$t("undo"),
onClick: (e, toastObject) => {
this.params = oldParams;
toastObject.remove();
@@ -2224,10 +2231,10 @@ export default {
const oldBodyParams = this.bodyParams.slice();
this.$store.commit("removeBodyParams", index);
this.$toast.error("Deleted", {
this.$toast.error(this.$t("deleted"), {
icon: "delete",
action: {
text: "Undo",
text: this.$t("undo"),
onClick: (e, toastObject) => {
this.bodyParams = oldBodyParams;
toastObject.remove();
@@ -2255,7 +2262,7 @@ export default {
document.execCommand("copy");
document.body.removeChild(dummy);
this.$refs.copyRequest.innerHTML = this.doneButton;
this.$toast.info("Copied to clipboard", {
this.$toast.info(this.$t("copied_to_clipboard"), {
icon: "done"
});
setTimeout(
@@ -2266,7 +2273,7 @@ export default {
},
copyRequestCode() {
this.$refs.copyRequestCode.innerHTML = this.doneButton;
this.$toast.success("Copied to clipboard", {
this.$toast.success(this.$t("copied_to_clipboard"), {
icon: "done"
});
this.$refs.generatedCode.select();
@@ -2283,7 +2290,7 @@ export default {
},
copyResponse() {
this.$refs.copyResponse.innerHTML = this.doneButton;
this.$toast.success("Copied to clipboard", {
this.$toast.success(this.$t("copied_to_clipboard"), {
icon: "done"
});
const aux = document.createElement("textarea");
@@ -2318,7 +2325,7 @@ export default {
document.body.appendChild(a);
a.click();
this.$refs.downloadResponse.innerHTML = this.doneButton;
this.$toast.success("Download started", {
this.$toast.success(this.$t("download_started"), {
icon: "done"
});
setTimeout(() => {
@@ -2448,7 +2455,7 @@ export default {
this.showModal = false;
} catch (error) {
this.showModal = false;
this.$toast.error("cURL is not formatted properly", {
this.$toast.error(this.$t("curl_invalid_format"), {
icon: "error"
});
}
@@ -2512,7 +2519,7 @@ export default {
this.scope = "";
}
e.target.innerHTML = this.doneButton;
this.$toast.info("Cleared", {
this.$toast.info(this.$t("cleared"), {
icon: "clear_all"
});
setTimeout(
@@ -2522,7 +2529,7 @@ export default {
},
saveRequest() {
if (!this.checkCollections()) {
this.$toast.error("Create a Collection", {
this.$toast.error(this.$t("create_collection"), {
icon: "error"
});
return;
@@ -2586,11 +2593,11 @@ export default {
this.rawParams = e.target.result;
};
reader.readAsText(file);
this.$toast.info("File imported", {
this.$toast.info(this.$t("file_imported"), {
icon: "attach_file"
});
} else {
this.$toast.error("Choose a file", {
this.$toast.error(this.$t("choose_file"), {
icon: "attach_file"
});
}
@@ -2600,7 +2607,7 @@ export default {
this.oidcDiscoveryUrl === "" &&
(this.authUrl === "" || this.accessTokenUrl === "")
) {
this.$toast.error("Please complete configuration urls.", {
this.$toast.error(this.$t("complete_config_urls"), {
icon: "error"
});
return;
@@ -2641,10 +2648,10 @@ export default {
removeOAuthToken(index) {
const oldTokens = this.tokens.slice();
this.$store.commit("removeOAuthToken", index);
this.$toast.error("Deleted", {
this.$toast.error(this.$t("deleted"), {
icon: "delete",
action: {
text: "Undo",
text: this.$t("undo"),
onClick: (e, toastObject) => {
this.tokens = oldTokens;
toastObject.remove();
@@ -2664,7 +2671,7 @@ export default {
name,
details
});
this.$toast.info("Token request saved");
this.$toast.info(this.$t("token_request_saved"));
this.showTokenRequestList = false;
} catch (e) {
this.$toast.error(e, {
@@ -2679,10 +2686,10 @@ export default {
);
if (targetReqIndex < 0) return;
this.$store.commit("removeOAuthTokenReq", targetReqIndex);
this.$toast.error("Deleted", {
this.$toast.error(this.$t("deleted"), {
icon: "delete",
action: {
text: "Undo",
text: this.$t("undo"),
onClick: (e, toastObject) => {
this.tokenReqs = oldTokenReqs;
toastObject.remove();

View File

@@ -4,7 +4,7 @@
<input id="tab-one" type="radio" name="options" checked="checked" />
<label for="tab-one">{{ $t("websocket") }}</label>
<div class="tab">
<pw-section class="blue" label="Request" ref="request">
<pw-section class="blue" :label="$t('request')" ref="request">
<ul>
<li>
<label for="url">{{ $t("url") }}</label>
@@ -39,13 +39,13 @@
<pw-section
class="purple"
label="Communication"
:label="$t('communication')"
id="response"
ref="response"
>
<ul>
<li>
<label for="log">Log</label>
<label for="log">{{ $t("log") }}</label>
<div id="log" name="log" class="log">
<span v-if="communication.log">
<span
@@ -94,7 +94,7 @@
<input id="tab-two" type="radio" name="options" />
<label for="tab-two">{{ $t("sse") }}</label>
<div class="tab">
<pw-section class="blue" label="Request" ref="request">
<pw-section class="blue" :label="$t('request')" ref="request">
<ul>
<li>
<label for="server">{{ $t("server") }}</label>
@@ -129,7 +129,7 @@
<pw-section
class="purple"
label="Communication"
:label="$t('communication')"
id="response"
ref="response"
>
@@ -243,7 +243,7 @@ export default {
connect() {
this.communication.log = [
{
payload: `Connecting to ${this.url}...`,
payload: this.$t("connecting_to", { name: this.url }),
source: "info",
color: "var(--ac-color)"
}
@@ -254,13 +254,13 @@ export default {
this.connectionState = true;
this.communication.log = [
{
payload: `Connected to ${this.url}.`,
payload: this.$t("connected_to", { name: this.url }),
source: "info",
color: "var(--ac-color)",
ts: new Date().toLocaleTimeString()
}
];
this.$toast.success("Connected", {
this.$toast.success(this.$t("connected"), {
icon: "sync"
});
};
@@ -270,12 +270,12 @@ export default {
this.socket.onclose = event => {
this.connectionState = false;
this.communication.log.push({
payload: `Disconnected from ${this.url}.`,
payload: this.$t("disconnected_from", { name: this.url }),
source: "info",
color: "#ff5555",
ts: new Date().toLocaleTimeString()
});
this.$toast.error("Disconnected", {
this.$toast.error(this.$t("disconnected"), {
icon: "sync_disabled"
});
};
@@ -288,7 +288,7 @@ export default {
};
} catch (ex) {
this.handleError(ex);
this.$toast.error("Something went wrong!", {
this.$toast.error(this.$t("something_went_wrong"), {
icon: "error"
});
}
@@ -300,7 +300,7 @@ export default {
this.disconnect();
this.connectionState = false;
this.communication.log.push({
payload: `An error has occurred.`,
payload: this.$t("error_occurred"),
source: "info",
color: "#ff5555",
ts: new Date().toLocaleTimeString()
@@ -349,7 +349,7 @@ export default {
start() {
this.events.log = [
{
payload: `Connecting to ${this.server}...`,
payload: this.$t("connecting_to", { name: this.server }),
source: "info",
color: "var(--ac-color)"
}
@@ -361,13 +361,13 @@ export default {
this.connectionSSEState = true;
this.events.log = [
{
payload: `Connected to ${this.server}.`,
payload: this.$t("connected_to", { name: this.server }),
source: "info",
color: "var(--ac-color)",
ts: new Date().toLocaleTimeString()
}
];
this.$toast.success("Connected", {
this.$toast.success(this.$t("connected"), {
icon: "sync"
});
};
@@ -377,12 +377,12 @@ export default {
this.sse.onclose = event => {
this.connectionSSEState = false;
this.events.log.push({
payload: `Disconnected from ${this.server}.`,
payload: this.$t("disconnected_from", { name: this.server }),
source: "info",
color: "#ff5555",
ts: new Date().toLocaleTimeString()
});
this.$toast.error("Disconnected", {
this.$toast.error(this.$t("disconnected"), {
icon: "sync_disabled"
});
};
@@ -395,14 +395,14 @@ export default {
};
} catch (ex) {
this.handleSSEError(ex);
this.$toast.error("Something went wrong!", {
this.$toast.error(this.$t("something_went_wrong"), {
icon: "error"
});
}
} else {
this.events.log = [
{
payload: `This browser doesn't seems to have Server Sent Events support.`,
payload: this.$t("browser_support_sse"),
source: "info",
color: "#ff5555",
ts: new Date().toLocaleTimeString()
@@ -414,7 +414,7 @@ export default {
this.stop();
this.connectionSSEState = false;
this.events.log.push({
payload: `An error has occurred.`,
payload: this.$t("error_occurred"),
source: "info",
color: "#ff5555",
ts: new Date().toLocaleTimeString()

View File

@@ -1,6 +1,6 @@
<template>
<div class="page">
<pw-section class="cyan" label="Theme" ref="theme">
<pw-section class="cyan" :label="$t('theme')" ref="theme">
<ul>
<li>
<label>{{ $t("background") }}</label>
@@ -58,7 +58,7 @@
</ul>
</pw-section>
<pw-section class="blue" label="Proxy" ref="proxy">
<pw-section class="blue" :label="$t('proxy')" ref="proxy">
<ul>
<li>
<div class="flex-wrap">
@@ -76,7 +76,7 @@
target="_blank"
rel="noopener"
>
<button class="icon" v-tooltip="'Wiki'">
<button class="icon" v-tooltip="$t('wiki')">
<i class="material-icons">help</i>
</button>
</a>
@@ -90,7 +90,7 @@
<button
class="icon"
@click="settings.PROXY_URL = `https://postwoman.apollotv.xyz/`"
v-tooltip.bottom="'Reset to default'"
v-tooltip.bottom="$t('reset_default')"
>
<i class="material-icons">clear_all</i>
</button>
@@ -152,26 +152,26 @@ export default {
themes: [
{
color: "#202124",
name: "Kinda Dark",
name: this.$t("kinda_dark"),
class: "",
aceEditor: "twilight"
},
{
color: "#ffffff",
name: "Clearly White",
name: this.$t("clearly_white"),
vibrant: true,
class: "light",
aceEditor: "iplastic"
},
{
color: "#000000",
name: "Just Black",
name: this.$t("just_black"),
class: "black",
aceEditor: "vibrant_ink"
},
{
color: "var(--bg-color)",
name: "Auto (system)",
name: this.$t("auto_system"),
vibrant: window.matchMedia("(prefers-color-scheme: light)").matches,
class: "auto",
aceEditor: window.matchMedia("(prefers-color-scheme: light)").matches
@@ -184,42 +184,42 @@ export default {
// If the color is vibrant, black is used as the active foreground color.
{
color: "#50fa7b",
name: "Green",
name: this.$t("green"),
vibrant: true
},
{
color: "#f1fa8c",
name: "Yellow",
name: this.$t("yellow"),
vibrant: true
},
{
color: "#ff79c6",
name: "Pink",
name: this.$t("pink"),
vibrant: true
},
{
color: "#ff5555",
name: "Red",
name: this.$t("red"),
vibrant: false
},
{
color: "#bd93f9",
name: "Purple",
name: this.$t("purple"),
vibrant: true
},
{
color: "#ffb86c",
name: "Orange",
name: this.$t("orange"),
vibrant: true
},
{
color: "#8be9fd",
name: "Cyan",
name: this.$t("cyan"),
vibrant: true
},
{
color: "#57b5f9",
name: "Blue",
name: this.$t("blue"),
vibrant: false
}
],