Changes to support weblate workflow (#2210)

This PR syncs the weblate branch back to main, and adds:
- New Spanish translations contributed in weblate!
- New GH action which reformats weblate commits with `localize:extract`,
ensuring strings are not changed, and also runs `localize:build` to
extract templates (as tested in PR: #2207)
- Reformats existing XLIFF files to match `localize:extract`, including
adding self-closing tags.
- Update on generated templates
- Prettier: disable alpha sorting XML attributes to hopefully minimize
conflcits
- Strings: change some strings that use `&` to be wrapped in html`` to
ensure proper unencoding, or just switch to 'and' where that's not
possible.

---------

Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: Webrecorder Dev <dev@webrecorder.org>
Co-authored-by: Kamborio <Kamborio15@users.noreply.hosted.weblate.org>
Co-authored-by: Clara Itzel <missclaraitzel@gmail.com>
Co-authored-by: weblate <weblate@users.noreply.github.com>
Co-authored-by: emma <hi@emma.cafe>
Co-authored-by: sua yoo <sua@webrecorder.org>
This commit is contained in:
Ilya Kreymer 2024-12-09 15:16:47 -08:00 committed by GitHub
parent b741de0232
commit b041baf5df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 2547 additions and 1845 deletions

View File

@ -27,8 +27,7 @@ jobs:
DOCS_SOURCE_URL: https://app.browsertrix.com
ENABLE_ANALYTICS: true
- name: Build & Deploy Docs
- name: Build Docs
run: cd frontend/docs; mkdocs gh-deploy --force
env:
SITE_URL: https://docs.browsertrix.com
ENABLE_ANALYTICS: true

View File

@ -10,10 +10,6 @@ on:
jobs:
setup-and-build:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
# Setup:
@ -78,17 +74,7 @@ jobs:
run: yarn lint:check
# Localize:
- name: Extract strings
working-directory: frontend
run: yarn localize:extract
- name: Commit extracted strings
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply `localize:extract` changes
file_pattern: '**/*.xlf'
skip_fetch: true
skip_checkout: true
- name: Check localization build
- name: Localization build dry run
working-directory: frontend
run: yarn localize:build

54
.github/workflows/weblate-reformat.yaml vendored Normal file
View File

@ -0,0 +1,54 @@
name: Weblate Reformat
on:
pull_request_target:
paths:
- 'frontend/xliff/**'
- '.github/workflows/weblate-reformat.yaml'
branches:
- 'weblate'
jobs:
setup-and-build:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
# Setup:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Install dependencies
working-directory: frontend
env:
HUSKY: 0
run: yarn install --frozen-lockfile
# Localize:
- name: Reformat XLIFF files
working-directory: frontend
run: yarn localize:extract
- name: Rebuild frontend templates
working-directory: frontend
run: yarn localize:build
- name: Commit changes to upstream branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Format Weblate Changes
file_pattern: '**/*.xlf **/__generated__/locales/*.ts'
skip_fetch: true
skip_checkout: true

View File

@ -1,5 +1,4 @@
site_name: Browsertrix Docs
site_url: !ENV SITE_URL
repo_url: https://github.com/webrecorder/browsertrix-cloud/
repo_name: Browsertrix
edit_uri: edit/main/frontend/docs/docs/

View File

@ -32,7 +32,7 @@ module.exports = {
parser: "xml",
proseWrap: "never",
printWidth: Infinity,
xmlSortAttributesByKey: true,
xmlSortAttributesByKey: false,
xmlWhitespaceSensitivity: "preserve",
xmlSelfClosingSpace: false,
},

View File

@ -6,6 +6,7 @@ let file = fs.readFileSync("yarn.lock", "utf8");
let json = lockfile.parse(file);
console.log(
Object.entries(json.object).find(([package]) => package.startsWith("@playwright/test"))[1]
.version,
Object.entries(json.object).find(([pkg]) =>
pkg.startsWith("@playwright/test"),
)[1].version,
);

File diff suppressed because it is too large Load Diff

View File

@ -257,7 +257,7 @@ export class WorkflowEditor extends BtrixElement {
FormState["scheduleType"],
string
> = {
date: msg("Run on a specific date & time"),
date: msg("Run on a specific date and time"),
cron: msg("Run on a recurring basis"),
none: msg("No schedule"),
};
@ -656,7 +656,7 @@ export class WorkflowEditor extends BtrixElement {
}}
>
<sl-icon slot="suffix" name="chevron-double-right"></sl-icon>
${msg("Review & Save")}
${msg(html`Review & Save`)}
</sl-button>
`;
}

View File

@ -461,7 +461,7 @@ export class WorkflowList extends LitElement {
render() {
return html` <div class="listHeader row">
<div class="col">${msg("Name & Schedule")}</div>
<div class="col">${msg(html`Name & Schedule`)}</div>
<div class="col">${msg("Latest Crawl")}</div>
<div class="col">${msg("Total Size")}</div>
<div class="col">${msg("Last Modified")}</div>

View File

@ -348,7 +348,7 @@ export class WorkflowDetail extends BtrixElement {
await this.cancel();
this.openDialogName = undefined;
}}
>${msg("Cancel & Discard Crawl")}</sl-button
>${msg(html`Cancel & Discard Crawl`)}</sl-button
>
</div>
</btrix-dialog>
@ -677,7 +677,7 @@ export class WorkflowDetail extends BtrixElement {
@click=${() => (this.openDialogName = "cancel")}
>
<sl-icon name="x-octagon" slot="prefix"></sl-icon>
${msg("Cancel & Discard Crawl")}
${msg(html`Cancel & Discard Crawl`)}
</sl-menu-item>
`,
() => html`

View File

@ -508,7 +508,7 @@ export class WorkflowsList extends BtrixElement {
@click=${() => void this.cancel(workflow.lastCrawlId)}
>
<sl-icon name="x-octagon" slot="prefix"></sl-icon>
${msg("Cancel & Discard Crawl")}
${msg(html`Cancel & Discard Crawl`)}
</sl-menu-item>
`,
)}

View File

@ -12,10 +12,10 @@ const infoText: Partial<Record<Field, string | TemplateResult>> = {
"Adds a hard limit on the number of pages that will be crawled.",
),
crawlTimeoutMinutes: msg(
`Gracefully stop archiving after the specified amount of time has elapsed.`,
`Gracefully stop the crawler after a specified time limit.`,
),
maxCrawlSizeGB: msg(
`Gracefully stop archiving after the specified amount of data has been captured.`,
`Gracefully stop the crawler after a specified size limit.`,
),
pageLoadTimeoutSeconds: msg(
`Limits amount of time to wait for a page to load. Behaviors will run after this timeout only if the page is partially or fully loaded.`,
@ -33,7 +33,7 @@ const infoText: Partial<Record<Field, string | TemplateResult>> = {
msg(`Choose a custom profile to make use of saved cookies and logged-in
accounts. Note that websites may log profiles out after a period of time.`),
crawlerChannel: msg(
`Choose a Browsertrix Crawler release channel. If available, other versions may provide new/experimental crawling features.`,
`Choose a Browsertrix Crawler Release Channel. If available, other versions may provide new/experimental crawling features.`,
),
blockAds: msg(
html`Blocks advertising content from being loaded. Uses

2989
frontend/xliff/es.xlf generated

File diff suppressed because it is too large Load Diff