Path: blob/main/tools/update_translate_template.sh
18080 views
#!/bin/sh1#2# Copyright (c) 2021 Danilo G. Baio <[email protected]>3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions are met:6#7# 1. Redistributions of source code must retain the above copyright notice, this8# list of conditions and the following disclaimer.9#10# 2. Redistributions in binary form must reproduce the above copyright notice,11# this list of conditions and the following disclaimer in the documentation12# and/or other materials provided with the distribution.13#14# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED16# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE17# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR20# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER21# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,22# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE23# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.242526ALL_COMPONENTS="documentation27website"2829COMPONENTS="${1:-$ALL_COMPONENTS}"3031GIT_IGNORE_FILES="toc-examples.adoc32toc-figures.adoc33toc-tables.adoc34toc.adoc35toc-1.adoc36toc-2.adoc37toc-3.adoc38toc-4.adoc39toc-5.adoc"4041IGNORE_FILES="contrib-386bsd42contrib-additional43contrib-committers44contrib-corealumni45contrib-develalumni46contrib-portmgralumni"4748for remove_file in $GIT_IGNORE_FILES; do49find documentation/content/en/ -name "$remove_file" -delete -print || exit 150done5152for component in $COMPONENTS; do5354if [ ! -d "$component/content/en" ]; then55echo "Directory '$component/content/en' not found."56exit 157fi5859for document in $(find "$component/content/en/" -name "*.adoc" ); do60name=$(basename -s .adoc "$document")6162# Ignore some files63if [ "$name" = "chapters-order" ]; then64continue65fi6667if [ "$document" = "documentation/content/en/books/books.adoc" ]; then68continue69fi7071if echo "$IGNORE_FILES" | grep -q -w "$name"; then72continue73fi7475dirbase=$(dirname "$document")76echo "$document"7778po4a-updatepo \79--format asciidoc \80--option compat=asciidoctor \81--option tablecells=1 \82--option yfm_keys=title,part,description \83--master "$document" \84--master-charset "UTF-8" \85--copyright-holder "The FreeBSD Project" \86--package-name "FreeBSD Documentation" \87--po "$dirbase/$name.po"88if [ -f "$dirbase/$name.po~" ]; then89rm -f "$dirbase/$name.po~"90fi91done92done93949596