From e725c418a40443bed703b670d527d2b1e9d77d1a Mon Sep 17 00:00:00 2001 From: Stephanie Hobson Date: Wed, 20 Mar 2024 10:51:29 -0700 Subject: [PATCH] Schedule task to remove obsolete l10n strings Fix #14259 (#14328) * Schedule task to remove obsolete l10n strings Fix #14259 --- .github/workflows/routine_l10n_obsolete.yml | 59 +++++++++++++++++++++ docs/l10n.rst | 11 +++- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/routine_l10n_obsolete.yml diff --git a/.github/workflows/routine_l10n_obsolete.yml b/.github/workflows/routine_l10n_obsolete.yml new file mode 100644 index 00000000000..a1b6d2eff5b --- /dev/null +++ b/.github/workflows/routine_l10n_obsolete.yml @@ -0,0 +1,59 @@ +name: Create l10n cleanup task +on: + schedule: + - cron: 0 09 14 */2 * + +jobs: + create_issue: + name: Create l10n cleanup task + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Create l10n cleanup task + run: | + if [[ $CLOSE_PREVIOUS == true ]]; then + previous_issue_number=$(gh issue list \ + --label "$LABELS" \ + --json number \ + --jq '.[0].number') + if [[ -n $previous_issue_number ]]; then + gh issue close "$previous_issue_number" + gh issue unpin "$previous_issue_number" + fi + fi + new_issue_url=$(gh issue create \ + --title "$TITLE" \ + --assignee "$ASSIGNEES" \ + --label "$LABELS" \ + --body "$BODY") + if [[ $PINNED == true ]]; then + gh issue pin "$new_issue_url" + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + TITLE: Remove obsolete l10n strings and ftl files + ASSIGNEES: + LABELS: L10N + BODY: | + ### Remove obsolete strings + + Search the code base for strings marked `obsolete` that are more than 2 months old. + If you find strings that have no date, either find the date by looking at git history + or add an expiry date and leave it to be removed in 2 months. + + - [ ] Remove old obsolete strings + + ### Remove obsolete ftl files + + Compare the files in /l10n/en-US/ to the /en/ folder in the www-l10n repo and remove + files from www-l10n that no longer exist in bedrock. + + If you have both repos installed and up to date you can run this command: + `diff -r www-l10n/en bedrock/l10n/en | grep ".ftl"` + + - [ ] Remove files + - [ ] Remove references in www-l10n/configs/pontoon.toml + PINNED: false + CLOSE_PREVIOUS: true diff --git a/docs/l10n.rst b/docs/l10n.rst index 8b67cc3b214..6d3b676b247 100644 --- a/docs/l10n.rst +++ b/docs/l10n.rst @@ -222,7 +222,14 @@ Obsolete strings ~~~~~~~~~~~~~~~~ When new strings are added to a page sometimes they update or replace old strings. Obsolete strings & IDs should be removed from ftl files -immediately if they are not being used as a fallback. If they are being kept as a fallback they should be removed after 1-2 months. +immediately if they are not being used as a fallback. If they are being kept as a fallback they should be removed after 2 months. + +When you add a comment marking as string as obsolete add the date it can be removed to the comment. + +.. code-block:: fluent + + # Obsolete string (expires: 2024-03-18) + example-old-string = Fifty thousand year old twisted bark threads. Fallback @@ -234,7 +241,7 @@ suffix to the new string ID: e.g. ``firefox-new-skyline-main-page-title-v2``. .. code-block:: fluent example-block-title-v2 = Security, reliability and speed — on every device, anywhere you go. - # Obsolete string + # Obsolete string (expires: 2024-03-18) example-block-title = Security, reliability and speed — from name you can trust.