lang_extract.sh
来自「-一个LINUX下的使用方便 的CD-ROM刻录软件,开放源码」· Shell 代码 · 共 53 行
SH
53 行
#!/bin/sh## language extractor v0.2# 21.01.00 tn# 07.03.00 enhanced by Chih-Wei Huang#if [ "$1" = "" ]; then echo "Usage: lang_extract.sh language-id" exit;fi# check if the backup files already exist..if not create themif [ ! -f language.def.org -o ! -f langhelp.def.org ]; then echo "Creating backup files (.org)" cp language.def language.def.org cp langhelp.def langhelp.def.org fi# args: $1 language id# this adds empty strings for non existing translations.function extract_lang(){ cat - | awk -v i="$1" ' { if (match($1,/^[[:digit:]]*_0/)) { s=1 split($1,a,"_") } else { if (s == 1) { if (!match($1,/^[[:digit:]]*_/)) print a[1]"_"i": \"\"" s=0 } } print } '}# extract lines with language 0 and given id to new language file# including empty lines and commentsechoecho "Creating new languages files for id $1..."egrep "_0:|_$1:|^#|^\$" language.def.org | extract_lang $1 >language.defegrep "_0:|_$1:|^#|^\$" langhelp.def.org | extract_lang $1 >langhelp.defecho echo "----------"echo " Please read TRANSLATION.HOWTO for further translation instructions"echo "----------"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?