mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-25 17:27:18 +00:00
"insert_sd_usb2" message didn't include the "ChromeOS is missing or damaged" text, also is too long for certain locales. We should revise message and check if the locale fits screen width. BRANCH=none BUG=none TEST=cd strings; make # all pass Change-Id: Ie9cb5e4ecd6d143772ffa8e7de29c202e9bde130 Reviewed-on: https://gerrit.chromium.org/gerrit/30824 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Ready: Hung-Te Lin <hungte@chromium.org>
52 lines
1.2 KiB
Bash
Executable File
52 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# Generates localized text images
|
|
|
|
SCRIPT="$(readlink -f "$0")"
|
|
SCRIPT_DIR="$(dirname "$SCRIPT")"
|
|
TXT_TO_PNG=$(readlink -f "$SCRIPT_DIR/../text_to_png")
|
|
BACKGROUND="$SCRIPT_DIR/../../images/Background_white.png"
|
|
|
|
die() {
|
|
echo "ERROR: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
get_width() {
|
|
local input="$1"
|
|
identify -format "%w" "$input"
|
|
}
|
|
|
|
do_locale() {
|
|
local locale_dir="$1"
|
|
local max_width="$2"
|
|
local locale="$(basename $locale_dir)"
|
|
local file conf entry font
|
|
|
|
font="$(sed -nre "s/^$locale: *(.*) *$/\1/p" $SCRIPT_DIR/font.conf)"
|
|
for file in $locale_dir/*.txt; do
|
|
entry="$(basename $file)"
|
|
entry="${entry%%.*}"
|
|
conf="$(sed -nre "s/^$entry: *(.*) *$/\1/p" $SCRIPT_DIR/text.conf)"
|
|
$TXT_TO_PNG --lan="$locale" --font="$font" $conf $file
|
|
if [ "$(get_width ${file%.*}.png)" -gt $max_width ]; then
|
|
die "Error: message to long: $entry"
|
|
fi
|
|
done
|
|
}
|
|
|
|
main() {
|
|
[ "$#" -gt "0" ] || die "Usage: $0 locale(s)..."
|
|
|
|
local max_width="$(( $(get_width $BACKGROUND) * 4 / 5 ))"
|
|
for locale in "$@"; do
|
|
do_locale "$locale" "$max_width"
|
|
done
|
|
}
|
|
|
|
set -e
|
|
main "$@"
|