class LangF extends React.Component { constructor(props) { super(props); this.state = { lan: "English", showElem: "none", }; } componentWillMount() { if (this.props.lan === "kr") { this.setState({ lan: "한국인", }) } if (this.props.lan === "vn") { this.setState({ lan: "Việt Nam", }) } if (this.props.lan === "ru") { this.setState({ lan: "Русский", }) } if (this.props.lan === "id") { this.setState({ lan: "Indonesia", }) } if (this.props.lan === "in") { this.setState({ lan: "इंडी", }) } if (this.props.lan === "bd") { this.setState({ lan: "বাংলা", }) } if (this.props.lan === "my") { this.setState({ lan: "Melayu", }) } if (this.props.lan === "ar") { this.setState({ lan: "عرب", }) } if (this.props.lan === "hk") { this.setState({ lan: "繁體中文", }) } if (this.props.lan === "pt") { this.setState({ lan: "Portugal", }) } if (this.props.lan === "tr") { this.setState({ lan: "Türk", }) } } chooselang(param, event) { var str = location.pathname; console.log(str); if (this.props.lan !== "index") { str = str.substring(3) console.log(str); } if (param === 1) { location.href = str } if (param === 2) { location.href = "/kr" + str } if (param === 3) { location.href = "/vn" + str } if (param === 4) { location.href = "/ru" + str } if (param === 5) { location.href = "/id" + str } if (param === 6) { location.href = "/in" + str } if (param === 7) { location.href = "/bd" + str } if (param === 8) { location.href = "/my" + str } if (param === 9) { location.href = "/ar" + str } if (param === 10) { location.href = "/hk" + str } if (param === 11) { location.href = "/pt" + str } if (param === 12) { location.href = "/tr" + str } } render() { return (
{ this.setState({ showElem: "none" }) }} >
{ this.setState({ showElem: "block" }) }}>

{this.state.lan}

{ this.setState({ showElem: "none" }) }} >
this.chooselang(1)} >English
this.chooselang(2)} >한국인
this.chooselang(3)} >Việt Nam
this.chooselang(4)} >Русский
this.chooselang(5)} >Indonesia
this.chooselang(6)} >इंडी
this.chooselang(7)} >বাংলা
this.chooselang(8)} >Melayu
this.chooselang(9)} >عرب
this.chooselang(10)} >繁體中文
this.chooselang(11)} >Portugal
this.chooselang(12)} >Türk
); } }