]> Untitled Git - lemmy.git/blob - ui/src/components/create-community.tsx
Adding support for internationalization / i18n (#189)
[lemmy.git] / ui / src / components / create-community.tsx
1 import { Component } from 'inferno';
2 import { CommunityForm } from './community-form';
3 import { Community } from '../interfaces';
4 import { WebSocketService } from '../services';
5 import { i18n } from '../i18next';
6 import { T } from 'inferno-i18next';
7
8 export class CreateCommunity extends Component<any, any> {
9
10   constructor(props: any, context: any) {
11     super(props, context);
12     this.handleCommunityCreate = this.handleCommunityCreate.bind(this);
13   }
14
15   componentDidMount() {
16     document.title = `${i18n.t('create_community')} - ${WebSocketService.Instance.site.name}`;
17   }
18
19   render() {
20     return (
21       <div class="container">
22         <div class="row">
23           <div class="col-12 col-lg-6 offset-lg-3 mb-4">
24             <h5><T i18nKey="create_community">#</T></h5>
25             <CommunityForm onCreate={this.handleCommunityCreate}/>
26           </div>
27         </div>
28       </div>
29     )
30   }
31
32   handleCommunityCreate(community: Community) {
33     this.props.history.push(`/c/${community.name}`);
34   }
35 }
36
37