From owner-dev-commits-doc-all@freebsd.org Fri Sep 10 20:16:13 2021 Return-Path: Delivered-To: dev-commits-doc-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B73D66216A for ; Fri, 10 Sep 2021 20:16:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5nFT19s5z3tn1; Fri, 10 Sep 2021 20:16:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2284133FB; Fri, 10 Sep 2021 20:16:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18AKGCRO023591; Fri, 10 Sep 2021 20:16:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AKGCJM023590; Fri, 10 Sep 2021 20:16:12 GMT (envelope-from git) Date: Fri, 10 Sep 2021 20:16:12 GMT Message-Id: <202109102016.18AKGCJM023590@gitrepo.freebsd.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: =?utf-8?Q?Fernando Apestegu=C3=ADa?= Subject: git: ee7f388663 - main - [docs] tools/translate.sh: Add fixups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee7f3886637acdaf6bdbf5a753f63935b88bf65d Auto-Submitted: auto-generated X-BeenThere: dev-commits-doc-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the doc repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 20:16:13 -0000 The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/doc/commit/?id=ee7f3886637acdaf6bdbf5a753f63935b88bf65d commit ee7f3886637acdaf6bdbf5a753f63935b88bf65d Author: Fernando ApesteguĂ­a AuthorDate: 2021-09-05 16:36:26 +0000 Commit: Fernando ApesteguĂ­a CommitDate: 2021-09-10 18:12:54 +0000 [docs] tools/translate.sh: Add fixups Add fixups for several chores we needed to do by hand. * Fix tags: and trademarks: lists * Fix paths to point to the proper language and not to master Reviewed by: dbaio@ Differential Revision: https://reviews.freebsd.org/D31882 --- tools/translate.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/translate.sh b/tools/translate.sh index af3335ec91..632c370255 100755 --- a/tools/translate.sh +++ b/tools/translate.sh @@ -1,6 +1,7 @@ #!/bin/sh # # Copyright (c) 2021 Danilo G. Baio +# Copyright (c) 2021 Fernando Apesteguia # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -23,6 +24,34 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +######################################################### +# This is a temporary fix for po4a-translate command # +# po4a: Fix YAML Front Matter / tags and trademarks # +# https://wiki.freebsd.org/Doc/IdeaList#Translation # +# $1: File to fix # +######################################################### +fixup_lists() +{ + sed -i '' -E -e "s/(tags|trademarks).*'\[(.*)]'/\1: [\2]/g" "${1}" +} + +######################################################### +# Fix includes. In a few cases we want to include the # +# master (aka English) version of the includes # +# S1: file to fix # +# $2: language # +######################################################### +fixup_includes() +{ + # Replace ...shared/en/... with shared/$LANGUAGE + # content/en with content/$LANGUAGE in includes + sed -i '' -E -e "s,include::(.*)shared/en/,include::\1shared/${2}/," \ + -e "s,\{include-path\}(contrib*),content/en/articles/contributors/\1," \ + -e "s,include-path: content/en/,include-path: content/${2}/," \ + -e "s,(include::.*)contrib-develinmemoriam(.*),include::{include-path}contrib-develinmemoriam\2," \ + -e "s,(:chapters-path: |include::)content/en/books,\1content/${2}/books," \ + "${1}" +} if [ "$1" = "" ] || [ "$2" = "" ]; then echo "Need to inform which component and|or language." @@ -73,6 +102,8 @@ for pofile in $(find "$COMPONENT/content/$LANGUAGE/" -name "*.po" ); do --localized "$adoc_lang" \ --localized-charset "UTF-8" \ --keep "$KEEP" - + + fixup_lists "${adoc_lang}" + fixup_includes "${adoc_lang}" "${LANGUAGE}" done