Make all config form help text localizable (#593)

This commit is contained in:
sua yoo 2023-02-13 16:53:33 -08:00 committed by GitHub
parent fea30d23ee
commit baa2214c9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -730,7 +730,7 @@ export class CrawlConfigEditor extends LiteElement {
return html`<div class="col-span-5 md:col-span-3">${content}</div> `; return html`<div class="col-span-5 md:col-span-3">${content}</div> `;
}; };
private renderHelpTextCol(content: TemplateResult, padTop = true) { private renderHelpTextCol(content: TemplateResult | string, padTop = true) {
return html` return html`
<div class="col-span-5 md:col-span-2 flex${padTop ? " pt-6" : ""}"> <div class="col-span-5 md:col-span-2 flex${padTop ? " pt-6" : ""}">
<div class="text-base mr-2"> <div class="text-base mr-2">
@ -785,8 +785,8 @@ https://example.com/path`}
></sl-textarea> ></sl-textarea>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`The crawler will visit and record each URL listed in the order msg(`The crawler will visit and record each URL listed in the order
defined here.` defined here.`)
)} )}
${when( ${when(
isCustom, isCustom,
@ -826,7 +826,7 @@ https://example.com/path`}
</sl-select> </sl-select>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Tells the crawler which pages it can visit.` msg(`Tells the crawler which pages it can visit.`)
)} )}
` `
)} )}
@ -837,8 +837,8 @@ https://example.com/path`}
${msg("Include Any Linked Page")} ${msg("Include Any Linked Page")}
</sl-checkbox>`)} </sl-checkbox>`)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`If checked, the crawler will visit pages one link away from a Crawl msg(`If checked, the crawler will visit pages one link away from a Crawl
URL.`, URL.`),
false false
)} )}
${when( ${when(
@ -865,8 +865,8 @@ https://example.com/path`}
</sl-button> </sl-button>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Specify exclusion rules for what pages should not be visited. msg(`Specify exclusion rules for what pages should not be visited.
Exclusions apply to all URLs.` Exclusions apply to all URLs.`)
)} )}
` `
)} )}
@ -978,7 +978,7 @@ https://example.com/path`}
}} }}
></sl-input> ></sl-input>
`)} `)}
${this.renderHelpTextCol(html`The starting point of your crawl.`)} ${this.renderHelpTextCol(msg(`The starting point of your crawl.`))}
${this.renderFormCol(html` ${this.renderFormCol(html`
<sl-select <sl-select
name="scopeType" name="scopeType"
@ -1009,7 +1009,7 @@ https://example.com/path`}
</sl-select> </sl-select>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Tells the crawler which pages it can visit.` msg(`Tells the crawler which pages it can visit.`)
)} )}
${when( ${when(
this.formState.scopeType === "custom", this.formState.scopeType === "custom",
@ -1027,8 +1027,8 @@ https://example.net`}
></sl-textarea> ></sl-textarea>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`If the crawler finds pages outside of the Start URL Scope they msg(`If the crawler finds pages outside of the Start URL Scope they
will only be saved if they begin with URLs listed here.` will only be saved if they begin with URLs listed here.`)
)} )}
` `
)} )}
@ -1041,8 +1041,8 @@ https://example.net`}
</sl-checkbox> </sl-checkbox>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`If checked, the crawler will visit pages one link away outside of msg(`If checked, the crawler will visit pages one link away outside of
Crawl Scope.`, Crawl Scope.`),
false false
)} )}
<div class="col-span-5"> <div class="col-span-5">
@ -1076,7 +1076,9 @@ https://example.net`}
</sl-button> </sl-button>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Specify exclusion rules for what pages should not be visited.` msg(
`Specify exclusion rules for what pages should not be visited.`
)
)} )}
</div></btrix-details </div></btrix-details
> >
@ -1132,8 +1134,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
></sl-textarea> ></sl-textarea>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`The crawler will visit and record each URL listed here. Other msg(`The crawler will visit and record each URL listed here. Other
links on these pages will not be crawled.` links on these pages will not be crawled.`)
)} )}
</div> </div>
</btrix-details> </btrix-details>
@ -1181,8 +1183,10 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-input> </sl-input>
</sl-mutation-observer> </sl-mutation-observer>
`)} `)}
${this.renderHelpTextCol(html`Adds a hard limit on the number of pages ${this.renderHelpTextCol(
that will be crawled.`)} msg(`Adds a hard limit on the number of pages
that will be crawled.`)
)}
${this.renderFormCol(html` ${this.renderFormCol(html`
<sl-input <sl-input
name="pageTimeoutMinutes" name="pageTimeoutMinutes"
@ -1201,8 +1205,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-input> </sl-input>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Adds a hard time limit for how long the crawler can spend on a msg(`Adds a hard time limit for how long the crawler can spend on a
single webpage.` single webpage.`)
)} )}
${this.renderFormCol(html` ${this.renderFormCol(html`
<sl-input <sl-input
@ -1217,7 +1221,7 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-input> </sl-input>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Gracefully stop the crawler after a specified time limit.` msg(`Gracefully stop the crawler after a specified time limit.`)
)} )}
${this.renderFormCol(html` ${this.renderFormCol(html`
<sl-radio-group <sl-radio-group
@ -1235,8 +1239,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-radio-group> </sl-radio-group>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Increasing parallel crawler instances can speed up crawls, but may msg(`Increasing parallel crawler instances can speed up crawls, but may
increase the chances of getting rate limited.` increase the chances of getting rate limited.`)
)} )}
`; `;
} }
@ -1255,8 +1259,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
></btrix-select-browser-profile> ></btrix-select-browser-profile>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Choose a custom profile to make use of saved cookies and logged-in msg(`Choose a custom profile to make use of saved cookies and logged-in
accounts.` accounts.`)
)} )}
${this.renderFormCol(html` ${this.renderFormCol(html`
<sl-checkbox name="blockAds" ?checked=${this.formState.blockAds}> <sl-checkbox name="blockAds" ?checked=${this.formState.blockAds}>
@ -1264,14 +1268,14 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-checkbox> </sl-checkbox>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Blocks advertising content from being loaded. Uses msg(html`Blocks advertising content from being loaded. Uses
<a <a
href="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" href="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
class="text-blue-600 hover:text-blue-500" class="text-blue-600 hover:text-blue-500"
target="_blank" target="_blank"
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
>Steven Blacks Hosts file</a >Steven Blacks Hosts file</a
>.`, >.`),
false false
)} )}
${this.renderFormCol(html` ${this.renderFormCol(html`
@ -1291,8 +1295,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
</btrix-language-select> </btrix-language-select>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Websites that observe the browsers language setting may serve msg(`Websites that observe the browsers language setting may serve
content in that language if available.` content in that language if available.`)
)} )}
`; `;
} }
@ -1317,8 +1321,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-radio-group> </sl-radio-group>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Should a crawl run immediately when setup is complete, on a set msg(`Should a crawl run immediately when setup is complete, on a set
day, or on a recurring schedule?` day, or on a recurring schedule?`)
)} )}
${when(this.formState.scheduleType === "cron", this.renderScheduleCron)} ${when(this.formState.scheduleType === "cron", this.renderScheduleCron)}
`; `;
@ -1351,7 +1355,7 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-select> </sl-select>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Limit the frequency for how often a crawl will run.` msg(`Limit the frequency for how often a crawl will run.`)
)} )}
${when( ${when(
this.formState.scheduleFrequency === "weekly", this.formState.scheduleFrequency === "weekly",
@ -1373,7 +1377,7 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-radio-group> </sl-radio-group>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`What day of the week should a crawl run on?` msg(`What day of the week should a crawl run on?`)
)} )}
` `
)} )}
@ -1393,7 +1397,7 @@ https://archiveweb.page/images/${"logo.svg"}`}
</sl-input> </sl-input>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`What day of the month should a crawl run on?` msg(`What day of the month should a crawl run on?`)
)} )}
` `
)} )}
@ -1434,7 +1438,7 @@ https://archiveweb.page/images/${"logo.svg"}`}
</div> </div>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`A crawl will run at this time in your current timezone.` msg(`A crawl will run at this time in your current timezone.`)
)} )}
${this.renderFormCol(html`<sl-checkbox ${this.renderFormCol(html`<sl-checkbox
name="runNow" name="runNow"
@ -1443,8 +1447,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
${msg("Also run a crawl immediately on save")} ${msg("Also run a crawl immediately on save")}
</sl-checkbox>`)} </sl-checkbox>`)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`If checked, a crawl will run at the time specified above and also msg(`If checked, a crawl will run at the time specified above and also
once when setup is complete.`, once when setup is complete.`),
false false
)} )}
`; `;
@ -1468,8 +1472,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
></sl-input> ></sl-input>
`)} `)}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Customize this crawl config and crawl name. Crawls are named after msg(`Customize this crawl config and crawl name. Crawls are named after
the starting URL(s) by default.` the starting URL(s) by default.`)
)} )}
${this.renderFormCol( ${this.renderFormCol(
html` html`
@ -1488,8 +1492,8 @@ https://archiveweb.page/images/${"logo.svg"}`}
` `
)} )}
${this.renderHelpTextCol( ${this.renderHelpTextCol(
html`Create or assign this crawl (and its outputs) to one or more tags msg(`Create or assign this crawl (and its outputs) to one or more tags
to help organize your archived data.` to help organize your archived data.`)
)} )}
`; `;
} }