From: Dessalines Date: Fri, 9 Aug 2019 01:58:04 +0000 (-0700) Subject: i18n translations first pass. X-Git-Url: http://these/git/%7Bthis.favIcon%7D?a=commitdiff_plain;h=75e014ef5a693ccfb4b6d3eacb1f5d52c9c7f010;p=lemmy.git i18n translations first pass. --- diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index 5181e45e..9f3476a8 100644 --- a/ui/src/components/comment-form.tsx +++ b/ui/src/components/comment-form.tsx @@ -1,7 +1,10 @@ import { Component, linkEvent } from 'inferno'; import { CommentNode as CommentNodeI, CommentForm as CommentFormI } from '../interfaces'; +import { capitalizeFirstLetter } from '../utils'; import { WebSocketService, UserService } from '../services'; import * as autosize from 'autosize'; +import { i18n } from '../i18next'; +import { T } from 'inferno-i18next'; interface CommentFormProps { postId?: number; @@ -25,12 +28,13 @@ export class CommentForm extends Component { post_id: this.props.node ? this.props.node.comment.post_id : this.props.postId, creator_id: UserService.Instance.user ? UserService.Instance.user.id : null, }, - buttonTitle: !this.props.node ? "Post" : this.props.edit ? "Edit" : "Reply", + buttonTitle: !this.props.node ? capitalizeFirstLetter(i18n.t('post')) : this.props.edit ? capitalizeFirstLetter(i18n.t('edit')) : capitalizeFirstLetter(i18n.t('reply')), } constructor(props: any, context: any) { super(props, context); + this.state = this.emptyState; if (this.props.node) { @@ -62,7 +66,7 @@ export class CommentForm extends Component {
- {this.props.node && } + {this.props.node && }
diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index a201ddd6..a05286ed 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -7,6 +7,8 @@ import * as moment from 'moment'; import { MomentTime } from './moment-time'; import { CommentForm } from './comment-form'; import { CommentNodes } from './comment-nodes'; +import { i18n } from '../i18next'; +import { T } from 'inferno-i18next'; enum BanType {Community, Site}; @@ -74,10 +76,10 @@ export class CommentNode extends Component { {node.comment.creator_name} {this.isMod && -
  • mod
  • +
  • #
  • } {this.isAdmin && -
  • admin
  • +
  • #
  • }
  • ( @@ -97,24 +99,24 @@ export class CommentNode extends Component { {this.state.showEdit && } {!this.state.showEdit && !this.state.collapsed &&
    -
    +
      {UserService.Instance.user && !this.props.viewOnly && <>
    • - reply + #
    • - {node.comment.saved ? 'unsave' : 'save'} + {node.comment.saved ? i18n.t('unsave') : i18n.t('save')}
    • {this.myComment && <>
    • - edit + #
    • - {!this.props.node.comment.deleted ? 'delete' : 'restore'} + {!this.props.node.comment.deleted ? i18n.t('delete') : i18n.t('restore')}
    • @@ -123,8 +125,8 @@ export class CommentNode extends Component { {this.canMod &&
    • {!this.props.node.comment.removed ? - remove : - restore + # : + # }
    • } @@ -134,14 +136,14 @@ export class CommentNode extends Component { {!this.isMod &&
    • {!this.props.node.comment.banned_from_community ? - ban : - unban + # : + # }
    • } {!this.props.node.comment.banned_from_community &&
    • - {`${this.isMod ? 'remove' : 'appoint'} as mod`} + {this.isMod ? i18n.t('remove_as_mod') : i18n.t('appoint_as_mod')}
    • } @@ -152,14 +154,14 @@ export class CommentNode extends Component { {!this.isAdmin &&
    • {!this.props.node.comment.banned ? - ban from site : - unban from site + # : + # }
    • } {!this.props.node.comment.banned &&
    • - {`${this.isAdmin ? 'remove' : 'appoint'} as admin`} + {this.isAdmin ? i18n.t('remove_as_admin') : i18n.t('appoint_as_admin')}
    • } @@ -167,11 +169,11 @@ export class CommentNode extends Component { }
    • - link + #
    • {this.props.markable &&
    • - {`mark as ${node.comment.read ? 'unread' : 'read'}`} + {node.comment.read ? i18n.t('mark_as_unread') : i18n.t('mark_as_read')}
    • }
    @@ -180,15 +182,15 @@ export class CommentNode extends Component {
    {this.state.showRemoveDialog &&
    - - + +
    } {this.state.showBanDialog &&
    - - + +
    {/* TODO hold off on expires until later */} {/*
    */} diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index c4efe1fb..066d524a 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -5,6 +5,7 @@ import { retryWhen, delay, take } from 'rxjs/operators'; import { UserOperation, Community, ListCommunitiesResponse, CommunityResponse, FollowCommunityForm, ListCommunitiesForm, SortType } from '../interfaces'; import { WebSocketService } from '../services'; import { msgOp } from '../utils'; +import { T } from 'inferno-i18next'; declare const Sortable: any; @@ -64,17 +65,17 @@ export class Communities extends Component { {this.state.loading ?
    :
    -
    List of communities
    +
    #
    - - - - - - + + + + + + @@ -89,8 +90,8 @@ export class Communities extends Component { @@ -109,9 +110,9 @@ export class Communities extends Component { return (
    {this.state.page > 1 && - + } - +
    ); } diff --git a/ui/src/components/community-form.tsx b/ui/src/components/community-form.tsx index e295dcbe..f6520fc6 100644 --- a/ui/src/components/community-form.tsx +++ b/ui/src/components/community-form.tsx @@ -3,8 +3,10 @@ import { Subscription } from "rxjs"; import { retryWhen, delay, take } from 'rxjs/operators'; import { CommunityForm as CommunityFormI, UserOperation, Category, ListCategoriesResponse, CommunityResponse } from '../interfaces'; import { WebSocketService } from '../services'; -import { msgOp } from '../utils'; +import { msgOp, capitalizeFirstLetter } from '../utils'; import * as autosize from 'autosize'; +import { i18n } from '../i18next'; +import { T } from 'inferno-i18next'; import { Community } from '../interfaces'; @@ -74,25 +76,25 @@ export class CommunityForm extends Component
    - +
    - +
    - +
    - +
    NameTitleCategorySubscribersPostsComments######
    {community.number_of_comments} {community.subscribed ? - Unsubscribe : - Subscribe + # : + # }