This file is indexed.

/usr/share/cmake/fcitx/fcitx-parse-po.sh is in fcitx-libs-dev 1:4.2.9.1-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#   Copyright (C) 2012~2013 by Yichao Yu
#   yyc1992@gmail.com
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

fcitx_str_match() {
    local pattern="$1"
    local string="$2"
    case "${string}" in
        $pattern)
            return 0
            ;;
        *)
            return 1
            ;;
    esac
}

fcitx_exts_match() {
    local in_file="$1"
    local ext
    shift
    for ext in "${@}"; do
        fcitx_str_match "*.${ext}" "${in_file}" && return 0
    done
    return 1
}

fcitx_msgid_to_varname() {
    local prefix="${1}"
    local msgid="${2}"
    echo -n "${prefix}___"
    echo -n "${msgid}" | "${_FCITX_PO_PARSER_EXECUTABLE}" --encode
}

fcitx_parse_po_file() {
    local po_lang="${1}"
    local pofile="${2}"
    local parse_res="${3}"
    "${_FCITX_PO_PARSER_EXECUTABLE}" --parse-po "${po_lang}" \
        "${pofile}" > "${parse_res}"
}

fcitx_find_str() {
    local prefix="${1}"
    local msgid="${2}"
    local varname="$(fcitx_msgid_to_varname "${prefix}" "${msgid}")"
    eval "echo -n \"\${${varname}}\"" | \
        "${_FCITX_PO_PARSER_EXECUTABLE}" --decode
}

all_po_langs=''

fcitx_lang_to_prefix() {
    local lang="${1}"
    echo -n "${lang}" | "${_FCITX_PO_PARSER_EXECUTABLE}" --encode
}

fcitx_parse_all_pos() {
    local po_cache="$1"
    local po_parse_cache_dir="$2"
    mkdir -p "${po_parse_cache_dir}"
    local po_lang
    local po_file
    local prefix
    local po_parse_cache_file
    local line
    while read line; do
        [ -z "${line}" ] && continue
        po_lang="${line%% *}"
        po_file="${line#* }"
        prefix="$(fcitx_lang_to_prefix "${po_lang}")"
        po_parse_cache_file="${po_parse_cache_dir}/${prefix}.fxpo"
        if [ "${po_parse_cache_file}" -ot "${po_file}" ] ||
            [ "${po_parse_cache_file}" -ot "${_FCITX_PO_PARSER_EXECUTABLE}" ] ||
            ! [ -f "${po_parse_cache_file}" ]; then
            echo "Parsing po file: ${po_file}"
            local unique_fname="${po_parse_cache_file}.$$"
            fcitx_parse_po_file "${po_lang}" "${po_file}" "${unique_fname}"
            mv "${unique_fname}" "${po_parse_cache_file}"
            echo "Finished parsing po file: ${po_file}"
        fi
    done <<EOF
$(cat "${po_cache}")
EOF
}

fcitx_load_all_pos() {
    local po_cache="$1"
    local po_parse_cache_dir="$2"
    local po_lang
    local po_file
    local prefix
    local po_parse_cache_file
    local line
    while read line; do
        [ -z "${line}" ] && continue
        po_lang="${line%% *}"
        po_file="${line#* }"
        prefix="$(fcitx_lang_to_prefix "${po_lang}")"
        po_parse_cache_file="${po_parse_cache_dir}/${prefix}.fxpo"
        . "${po_parse_cache_file}"
        all_po_langs="${all_po_langs} ${po_lang}"
    done <<EOF
$(cat "${po_cache}")
EOF
}

fcitx_find_str_for_lang() {
    local lang="${1}"
    local msgid="${2}"
    local prefix="$(fcitx_lang_to_prefix "${lang}")"
    fcitx_find_str "${prefix}" "${msgid}"
}