tizen 2.4 release
[apps/home/settings.git] / scripts / create_po_header.sh
1 #!/bin/bash
2
3 po_base_file="./resource/po/en.po"
4 header_dir="./setting-common/include"
5 header_file="setting-common-po-string.h"
6
7 write_header() {
8
9 cat << EOF > ${header_dir}/${header_file}
10 /*
11  * setting
12  *
13  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  */
28
29 #ifndef __SETTING_COMMON_PO_STRING_H__
30 #define __SETTING_COMMON_PO_STRING_H__
31
32 EOF
33 }
34
35 write_footer() {
36
37 cat << EOF >> ${header_dir}/${header_file}
38
39 #endif /* __SETTING_COMMON_PO_STRING_H__ */
40 EOF
41 }
42
43 main() {
44
45     if [ ! -f $po_base_file ];
46     then
47         echo "Create $header_file : Fail!"
48         echo "[Warning] ${po_base_file} file is not exist!"
49         exit -1;
50     fi
51
52
53     write_header
54     cat $po_base_file | grep -e "^msgid" | awk -F"\"" '{printf "#define %s\t\t\t\"%s\"\n", $2, $2}' | sort >> ${header_dir}/${header_file}
55     write_footer
56
57     echo "Create $header_file : Successed!"
58 }
59
60 main $*