Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/tools/po_spellcheck.sh
18080 views
1
#!/bin/sh
2
#
3
# Copyright (c) 2021 Fernando Apesteguia <[email protected]>
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions are met:
7
#
8
# 1. Redistributions of source code must retain the above copyright notice, this
9
# list of conditions and the following disclaimer.
10
#
11
# 2. Redistributions in binary form must reproduce the above copyright notice,
12
# this list of conditions and the following disclaimer in the documentation
13
# and/or other materials provided with the distribution.
14
#
15
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26
# Check for aspell. Everything else is in base.
27
COMMAND=msgexec
28
if ! command -v ${COMMAND} >/dev/null; then
29
echo "${COMMAND} not found, please run 'pkg install docproj'"
30
exit 1
31
fi
32
33
usage()
34
{
35
echo "${0} <path_to_po_file> <language>"
36
echo "Example: ${0} documentation/content/es/articles/bsdl-gpl/_index.po es"
37
}
38
39
if [ ${#} -ne 2 ]; then
40
usage
41
exit 1
42
fi
43
44
PO_FILE="${1}"
45
LANG="${2}"
46
47
# msgexec acts as a driver, invoking a command for every
48
# translated text
49
50
CURDIR=$(dirname "${0}")
51
msgexec -i "${PO_FILE}" "${CURDIR}"/po_check_entry.sh "${LANG}"
52
53