#!/bin/bash
# Program:
#   Chinese Language file for NutchEZ 
# Author:
#   Waue, Shunfa, Rock {waue, shunfa, rock}@nchc.org.tw
# Version:
#    1.0
# History:
#

############ Lang for master_install -Start ############
MI_main_echo_1="Welcome to use NutchEZ, this install program will create a new accunt and to assist you to setup the password of nutchuser."
MI_main_echo_2="Please confirm the install infomation of above ：1.Yes 2.No "
MI_main_echo_3="Installed successfully!"
MI_main_echo_4="You can visit the manage website ：http://$MasterIP_Address:8080"

## Lang for master_install_func.sh ##
### [for choose_lang()] ### 
MI_choose_lang_1="Please select a language: (1)English (2)中文" 
MI_choose_lang_2="Use (1/2):" 

### [for check_root()]### 
MI_check_root_1="Please change root to execute it!!!" 
MI_check_root_2="Identify is root" 
 
### [for check_systemInfo()]### 
MI_check_sys_1="check_systemInfo" 
MI_check_sys_2="Your system information is:" 

### [for install_packages()]### 
MI_install_pack_1="install_packages" 
MI_install_pack_2="Check dependent packages" 
MI_install_pack_if_1="It will install some packages (expect, ssh, and dialog)." 
MI_install_pack_if_2="Please manually install expect, ssh, and dialog.Please manually install expect, ssh, and dialog." 
 
### [for check_nez_installed()] ### 
MI_check_nez_1="chcheck_nez_installed" 
MI_check_nez_2="System already had NutchEz." 
MI_check_nez_3="System does not has NutchEz." 
 
### [for check_sunJava()] ### 
MI_check_sunJava_1="check_sunJava" 
MI_check_sunJava_2="NutchEz need Sun Java JDK 1.6.x or above version" 
MI_check_sunJava_if_1="Java is not Sun version, plz install sun Java 1.6.X" 
MI_check_sunJava_if_2="Please input your choice:" 
MI_check_sunJava_if_3="(1)System don't have Sun Java (2)Sun Java is in other path (3)Exit" 
MI_check_sunJava_if_4="Use (1/2/3): " 
MI_check_sunJava_if_5="Please install Sun Java manually!" 
MI_check_sunJava_if_6="Input Sun Java home path(ex. '/usr/lib/jvm/java-6-sun-1.6.0.12' or using default '/usr' ): " 
MI_check_sunJava_if_7="It is not Sun Java! Please install Sun Java manually !" 
MI_check_sunJava_if_8="Java version is too old (it need 1.6.X above)"
MI_check_sunJava_if_9="System has Sun Java 1.6 above version." 
MI_check_sunJava_if_10="Please install Sun JAVA 1.6.X or above version" 
 
### [for check_ssh()] ### 
MI_check_ssh_1="check_ssh" 
MI_check_ssh_2="System has ssh." 
MI_check_ssh_3="Please install ssh." 
MI_check_ssh_4="System has ssh Server (sshd)." 
MI_check_ssh_5="Please install ssh Server (sshd)." 
 
### [for check_dialog()] ### 
MI_check_dialog_1="check_dialog" 
MI_check_dialog_2="System has dialog." 
MI_check_dialog_3="Please install dialog." 
	 	 
#
MI_set_nutchuser_passwd_echo_1="Set password for nutchuser："
MI_set_nutchuser_passwd_echo_2="keyin the password again："

#
MI_select_eth_echo_1="System has detectable network cards as follows:"
MI_select_eth_echo_2="Please choose a netword card for NutchEZ. Use (1/2/3)："
MI_select_eth_echo_3="Your choose is：$net_choice"
MI_select_eth_echo_4="Master IP address is：$net_address"
MI_select_eth_echo_5="Master MAC address is：$net_MacAddr"

#
MI_show_master_info_echo_1="Master IP address is："
MI_show_master_info_echo_2="Master MAC address is： "


#
MI_make_ssh_key_echo_1="Producing SSH Key... "
MI_make_ssh_key_echo_2="SSH Key has been produced."

#
MI_set_haoop_site_echo_1="Setting hadoop-site.xml... "
MI_set_haoop_site_echo_2="Setting hadoop-site.xml finished."

#
MI_set_nutch_site_echo_1="Setting nutch-site.xml..."
MI_set_nutch_site_echo_2="Setting http.agent.url at line: $Line_NO..."
MI_set_nutch_site_echo_3="Editing http.agent.url, delete line $Line_NO."
MI_set_nutch_site_echo_4="Editing http.agent.url finished."
MI_set_nutch_site_echo_5="Setting http.agent.email at line：$Line_NO."
MI_set_nutch_site_echo_6="Editing http.agent.email, delete line $Line_NO."
MI_set_nutch_site_echo_7="Editing http.agent.email finished."
MI_set_nutch_site_echo_8="Editing hadoop-site.xmlfinished."

#
MI_format_HDFS_echo_1="Formatting HDFS..."
MI_format_HDFS_echo_2="HDFS has been formatted."

#
MI_start_up_NutchEZ_echo_1="Start up NutchEZ..."

#
MI_set_hosts_echo_1="Set hosts on master"

#
MI_install_Nutch_echo_1="Master's IP address is："
MI_install_Nutch_echo_2="Master's Hostname is："

#
MI_client_PassMasterIPAddr_echo_1="Edit MasterIP in client install file at line $Line_NO"
MI_client_PassMasterIPAddr_echo_2="Editing MasterIP..."
MI_client_PassMasterIPAddr_echo_3="MasterIP has been set."

#
MI_client_PassMaster_Hostname_echo_1="Edit master hostname in client install file at line $Line_NO"
MI_client_PassMaster_Hostname_echo_2="Editing Hostname..."
MI_client_PassMaster_Hostname_echo_3="Hostname has been set."

#
MI_make_client_install_echo_1="In function of make_client_install ..."

#
MI_start_up_tomcat_echo_1="Start up tomcat..."
MI_start_up_tomcat_echo_2="Please wait about 10 sec..."
MI_start_up_tomcat_echo_3="Tomcat has been started！"

#
MI_client_install_commands_echo_1="For client install, please refer commands as follows："
MI_client_install_commands_echo_2="cd ~"
MI_client_install_commands_echo_3="mkdir nutchez_client_install"
MI_client_install_commands_echo_4="cd nutchez_client_install"
MI_client_install_commands_echo_5="scp -r nutchuser@$MasterIP_Address:/home/nutchuser/nutchez/source/* ."
MI_client_install_commands_echo_6="sudo su"
MI_client_install_commands_echo_7="./client_install"

########## Lang for Master Install - End##########

########## Lang for Client Install - Start##########

# [Variables Declaration] #
## Lang for client_install ##
par_echo_1="Your master IP is:"
par_echo_2="Is this information cooect? (yes/no): "
par_echo_3="These parameters are correct."
par_echo_4="Please edit these parameters in this file."

## [Lang for client_install_fun.sh] ##
### [for choose_lang()] ###
choose_lang_1="Please choose your language: (1)English (2)中文"
choose_lang_2="(1/2):"

### [for check_root()]###
check_root_1="Please Change root to execute it!!!"
check_root_2="Identify is root."

### [for check_systemInfo()]###
check_sys_1="check_systemInfo"
check_sys_2="Your system information are: "

### [for install_packages()]###
install_pack_1="install_packages"
install_pack_2="Check dependent packages"
install_pack_if_1="It will install some packages (expect, ssh, and dialog)."
install_pack_if_2="Please manually install expect, ssh, and dialog."

### [for check_nez_installed()] ###
check_nez_1="chcheck_nez_installed"
check_nez_2="System already had NutchEz."
check_nez_3="System does not has NutchEz."

### [for check_sunJava()] ###
check_sunJava_1="check_sunJava"
check_sunJava_2="NutchEz need Sun Java JDK 1.6.x or above version"
check_sunJava_if_1="Java is not Sun version, plz install sun Java 1.6.X"
check_sunJava_if_2="Please input your choice: "
check_sunJava_if_3="(1)System don't have Sun Java (2)Sun Java is in other path (3)Exit"
check_sunJava_if_4="plz input (1/2/3): "
check_sunJava_if_5="Please install Sun Java manually!"
check_sunJava_if_6="Input Sun Java home path(ex. '/usr/lib/jvm/java-6-sun-1.6.0.12' or using default '/usr' ): "
check_sunJava_if_7="It is not Sun Java! Plz install Sun Java manually !"
check_sunJava_if_8="Java version is too old (it need 1.6.X above)"
check_sunJava_if_9="System has Sun Java 1.6 above version."
check_sunJava_if_10="Please install Sun JAVA 1.6.X or above version"

### [for check_ssh()] ###
check_ssh_1="check_ssh"
check_ssh_2="System has ssh."
check_ssh_3="Please install ssh."
check_ssh_4="System has ssh Server (sshd)."
check_ssh_5="Please install ssh Server (sshd)."

### [for check_dialog()] ###
check_dialog_1="check_dialog"
check_dialog_2="System has dialog."
check_dialog_3="Please install dialog."

### scp_master_nutchuser_sshkey() ###
scp_sshkey_d1="scp_master_nutchuser_sshkey"
scp_sshkey_d2="mkdir -p /home/nutchuser/"
scp_sshkey_d3="scp nutchuser@master:~/.ssh /home/nutchuser/"
scp_sshkey_expect_1="Password is error"
scp_sshkey_s1="scp correct."
scp_sshkey_s2="scp error,\n(1)plese check nutchuser password in server\n(2)nutchuser's authorized_keys in server\n(3)server's network status"
scp_sshkey_d4="chown -R nutchuser:nutchuser /home/nutchuser/.ssh"

### [for creat_nutchuser_account()] ###
create_nutchuser_d1="creat_nutchuser_account"
create_nutchuser_1="Plz input nutchuser password of master node: "
create_nutchuser_2="plz input nutchuser password, again: "
create_nutchuser_3="Two Passwords match."
create_nutchuser_4="Two passwords don't match, please re-input nutchuser's password."
create_nutchuser_s1="System already has nutchuser, change nutchuser password."
create_nutchuser_s2="Create nutchuser and change password."

### [for scp_packages()] ###
scp_packages_d1="scp_packages"
scp_packages_d2="chown -R nutchuser:nutchuser /opt/nutchez"
scp_packages_d3="scp -r nutchuser@\$1:/opt/nutchez/NutchezForClientOf_\$Master_IP_Address.tar.gz /home/nutchuser/nutchez/source"

### [for install_nutch_package()] ###
install_nutch_package_d1="install_nutch_package"

### [for recall_hostname_ip()] ###
recall_hostname_ip_d1="recall_hostname_ip"
recall_hostname_ip_1="net_address is"
recall_hostname_ip_2="net_MacAddr is"
recall_hostname_ip_3="System have multiple network device, which network use for this machine: "
recall_hostname_ip_4="Please choice(1/2/3...): "
recall_hostname_ip_d2="ssh nutchuser@\$1 echo \$net_address \$(hostname) \$net_MacAddr \>\> ~/nutchez/system/nutch_nodes"

########## Lang for Client Install - End##########

########## Lang for Master Remove - Start##########

# check root
MR_check_root_1="Please change root to execute it!!!"
MR_check_root_2="Identify is root, let's continue！"

# shutdown service
MR_shutdown_service_echo_1="Stop the service of slaves..."
MR_shutdown_service_echo_2="Stop the service of master..."
MR_shutdown_service_echo_3="The service of Master"

# remove_folders
MR_remove_folders_echo_1="Deleting floders and files of NutchEZ..."
MR_remove_folders_echo_2="Floders and files has deleted."

# edit_hosts
MR_edit_hosts_echo_1="Restoring /etc/hosts..."
MR_edit_hosts_echo_2="/etc/hosts restoring finished."

# user_delete
MR_user_delete_echo_1="Deleting user: nutchuser..."
MR_user_delete_echo_2="nutchuser has deleted"

# main
MR_main_echo_1="Warning - this program will remove nutchEZ, if you don't understard what this program to do, please press Ctrl+c to leave！"
MR_main_echo_2="This program will delete all of nutchEZ's files and folders and delete user nutchuser."
MR_main_echo_3="Are you sure to remove this node? 1.Yes 2.No "
MR_main_echo_4="NutchEZ had removed！"
MR_main_echo_5="You are cancelling this remove procedure！"
MR_main_echo_6="If you want to remove NutchEZ of this node, please execute this program again."

########## Lang for Master Remove - End ##########

########## Lang for Client Remove - Start ##########
# check root
CR_check_root_1="Please change root to execute it!!!"
CR_check_root_2="Identify is root！"

# shutdown service
CR_shutdown_service_echo_1="Shutdown all service of this node..."
CR_shutdown_service_echo_2="The service of this node had shutdown."

# remove_folders
CR_remove_folders_echo_1="Deleting floders and files of NutchEZ..."
CR_remove_folders_echo_2="Floders and files has deleted."

# edit_hosts
CR_edit_hosts_echo_1="Restoring /etc/hosts..."
CR_edit_hosts_echo_2="/etc/hosts restoring finished."

# user_delete
CR_user_delete_echo_1="Deleting user: nutchuser..."
CR_user_delete_echo_2="nutchuser has deleted"

# main
CR_main_echo_1="Warning - this program will remove nutchEZ, if you don't understard what this program to do, please press Ctrl+c to leave！"
CR_main_echo_2="This program will delete all of nutchEZ's files and folders and delete user nutchuser."
CR_main_echo_3="Are you sure to remove this node? 1.Yes 2.No "
CR_main_echo_4="NutchEZ had removed！"
CR_main_echo_5="You are cancelling this remove procedure！"
CR_main_echo_6="If you want to remove NutchEZ of this node, please execute this program again."
########## Lang for Client Remove - End ##########

########## Lang for nutchez - Start ##########
# [Variables Declaration] #
## Lang for common ##
user_error="You aren't nutchuser，please change to  \"nutchuser\" !!!"

## [Lang for dialog] ##
dia_back='= [NutchEz Management Interface] ~by NCHC ='
dia_choose="Please choose what you want to do: "
dia_backto_main="Back to Main Menu"
dia_exit="Exit"

## [Lang for prepare_check] ##
dia_pre_check_title_1="[file nutch_nodes]"
dia_pre_check_msg_1="Failure：System can't find it!"
dia_pre_check_title_2="[Update /etc/host]"
dia_pre_check_yesno_1="You are frist execute NutchEz Management Interface"
dia_pre_check_yesno_2="Please update /etc/hosts !!!"
pre_check_echo_1="Please enter root's password to update /etc/hosts !!!"
pre_check_echo_2="root password error，please make sure root's password is correct!!!"
dia_pre_check_yesno_3="nutch_nodes has modified"

## [Lang for main_menu()] ##
dia_main_title_1="[Management Options]"
dia_main_menu_1_1="Check cluster state"
dia_main_menu_1_2="Set datanode & tasktracker"
dia_main_menu_1_3="Set namenode & jobtracker"
dia_main_menu_1_4="Startup/Shutdown/Restart Tomcat"
dia_main_menu_1_5="Change Tomcat port"
dia_main_menu_1_6="Change language"

## [Lang for cluster_status()] ##
cluster_status_echo_1="[IP] \t\t [Hostname] \t [Network] \t [Dtatnode & Tasktracker]"
cluster_status_echo_2="Start check cluster..."
cluster_status_read_1="press any key to continue..."
dia_cluster_status_title_1="[Cluster state]"

## [Lang for srver_setup()] ##
dia_server_title_1="[Server State]"
dia_server_msg_1="Namenode & Jobtracker shutdown"
dia_server_msg_2="Jobtracker running, Namenode shutdown"
dia_server_msg_3="Namenode running, Jobtracker shutdown"
dia_server_msg_4="Namenode & Jobtracker running"
dia_server_title_2="[Set Namenode & Jobtracker]"
dia_server_menu_1_1="Startup Namenode & Jobtracker"
dia_server_menu_1_2="Shutdown Namenode & Jobtracker"
dia_server_menu_1_3="Restart Namenode & Jobtracker"

## [Labg for cluster_setup()] ##
dia_cluster_setup_title_1="[All or part of nodes]"
dia_cluster_setup_menu_1_1="All nodes"
dia_cluster_setup_menu_1_2="A part of nodes"
dia_cluster_setup_title_2="[Select Datanode & Tasktracker Nodes]"
dia_cluster_setup_check_1="Select Datanode & Tasktracker: "
dia_cluster_setup_title_3="[Set Datanode & Tasktracker]"
dia_cluster_setup_menu_2_1="Startup Datanodes & Tasktrackers"
dia_cluster_setup_menu_2_2="Shutdown Datanodes & Tasktrackers"
dia_cluster_setup_menu_2_3="Restart Datanodes & Tasktrackers"
cluster_setup_echo_1="[Startup datanode & tasktracker]"
cluster_setup_echo_error="Failure：can't connect to ssh "
cluster_setup_echo_3="[Shutdown datanode & tasktracker]"
cluster_setup_echo_5="[Restart datanode & tasktracker]"

## [Lang for tomcat_swith()] #
dia_tomcat_switch_title_1="[Tomcat state]"
dia_tomcat_switch_msg_1="Tomcat is running !!!"
dia_tomcat_switch_msg_2="Tomcat doesn't run !!!"
dia_tomcat_switch_title_2="[The service of Tomcat]"
dia_tomcat_switch_menu_1_1="Startup Tomcat"
dia_tomcat_switch_menu_1_2="Stop Tomcat"
dia_tomcat_switch_menu_1_3="Restart Tomcat"
tomcat_switch_echo_1="Failure：System can't find it!"
tomcat_switch_echo_3="[Start up Tomcat]"
tomcat_switch_echo_4="[Shutdown Tomcat]"
tomcat_switch_echo_5="[Restart Tomcat]"

## [Lang for tomcat_port()] ##
dia_tomcat_port_title_1="[Edit Tomcat servel.xml]"
dia_tomcat_port_msg_1="Edit failure: Can't find the file."
dia_tomcat_port_title_2="[Change Tomcat Port ]"
dia_tomcat_port_input_1="Please enter tomcat port NO.(default 8080): "

## [Lang for lang_switch()] ##
dia_lang_title_1="[Change language]"
dia_lang_menu_1_1="English"
dia_lang_menu_1_2="中文"
########## Lang for nutchez - End ##########
