Browse Source

Adding back end translations.

pull/1/head
Dessalines 3 years ago
parent
commit
d58efa4cad
  1. 2
      src/components/communities.tsx
  2. 2
      src/components/community-form.tsx
  3. 2
      src/components/community.tsx
  4. 2
      src/components/inbox.tsx
  5. 2
      src/components/login.tsx
  6. 2
      src/components/main.tsx
  7. 2
      src/components/modlog.tsx
  8. 2
      src/components/post-form.tsx
  9. 2
      src/components/post.tsx
  10. 2
      src/components/search.tsx
  11. 2
      src/components/setup.tsx
  12. 2
      src/components/user.tsx
  13. 3
      src/services/WebSocketService.ts
  14. 33
      src/translations/en.ts
  15. 14
      yarn.lock

2
src/components/communities.tsx

@ -167,7 +167,7 @@ export class Communities extends Component<any, CommunitiesState> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.ListCommunities) {
let res: ListCommunitiesResponse = msg;

2
src/components/community-form.tsx

@ -155,7 +155,7 @@ export class CommunityForm extends Component<CommunityFormProps, CommunityFormSt
let op: UserOperation = msgOp(msg);
console.log(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
this.state.loading = false;
this.setState(this.state);
return;

2
src/components/community.tsx

@ -194,7 +194,7 @@ export class Community extends Component<any, State> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.GetCommunity) {
let res: GetCommunityResponse = msg;

2
src/components/inbox.tsx

@ -166,7 +166,7 @@ export class Inbox extends Component<any, InboxState> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.GetReplies || op == UserOperation.MarkAllAsRead) {
let res: GetRepliesResponse = msg;

2
src/components/login.tsx

@ -184,7 +184,7 @@ export class Login extends Component<any, State> {
parseMessage(msg: any) {
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
this.state = this.emptyState;
this.setState(this.state);
return;

2
src/components/main.tsx

@ -382,7 +382,7 @@ export class Main extends Component<any, MainState> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.GetFollowedCommunities) {
let res: GetFollowedCommunitiesResponse = msg;

2
src/components/modlog.tsx

@ -223,7 +223,7 @@ export class Modlog extends Component<any, ModlogState> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.GetModlog) {
let res: GetModlogResponse = msg;

2
src/components/post-form.tsx

@ -203,7 +203,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
parseMessage(msg: any) {
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
this.state.loading = false;
this.setState(this.state);
return;

2
src/components/post.tsx

@ -244,7 +244,7 @@ export class Post extends Component<any, PostState> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.GetPost) {
let res: GetPostResponse = msg;

2
src/components/search.tsx

@ -246,7 +246,7 @@ export class Search extends Component<any, SearchState> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.Search) {
let res: SearchResponse = msg;

2
src/components/setup.tsx

@ -135,7 +135,7 @@ export class Setup extends Component<any, State> {
parseMessage(msg: any) {
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
this.state.userLoading = false;
this.setState(this.state);
return;

2
src/components/user.tsx

@ -333,7 +333,7 @@ export class User extends Component<any, UserState> {
console.log(msg);
let op: UserOperation = msgOp(msg);
if (msg.error) {
alert(msg.error);
alert(i18n.t(msg.error));
return;
} else if (op == UserOperation.GetUserDetails) {
let res: UserDetailsResponse = msg;

3
src/services/WebSocketService.ts

@ -4,6 +4,7 @@ import { webSocket } from 'rxjs/webSocket';
import { Subject } from 'rxjs';
import { retryWhen, delay, take } from 'rxjs/operators';
import { UserService } from './';
import { i18n } from '../i18next';
export class WebSocketService {
private static _instance: WebSocketService;
@ -192,7 +193,7 @@ export class WebSocketService {
private setAuth(obj: any, throwErr: boolean = true) {
obj.auth = UserService.Instance.auth;
if (obj.auth == null && throwErr) {
alert("Not logged in.");
alert(i18n.t('not_logged_in'));
throw "Not logged in";
}
}

33
src/translations/en.ts

@ -122,6 +122,39 @@ export const en = {
joined: 'Joined',
powered_by: 'Powered by',
landing_0: 'Lemmy is a <1>link aggregator</1> / reddit alternative, intended to work in the <2>fediverse</2>.<3></3>Its self-hostable, has live-updating comment threads, and is tiny (<4>~80kB</4>). Federation into the ActivityPub network is on the roadmap. <5></5>This is a <6>very early beta version</6>, and a lot of features are currently broken or missing. <7></7>Suggest new features or report bugs <8>here.</8><9></9>Made with <10>Rust</10>, <11>Actix</11>, <12>Inferno</12>, <13>Typescript</13>.',
not_logged_in: 'Not logged in.',
community_ban: 'You have been banned from this community.',
site_ban: 'You have been banned from the site',
couldnt_create_comment: 'Couldn\'t create comment.',
couldnt_like_comment: 'Couldn\'t like comment.',
couldnt_update_comment: 'Couldn\'t update comment.',
couldnt_save_comment: 'Couldn\'t save comment.',
no_comment_edit_allowed: 'Not allowed to edit comment.',
no_post_edit_allowed: 'Not allowed to edit post.',
no_community_edit_allowed: 'Not allowed to edit community.',
couldnt_find_community: 'Couldn\'t find community.',
couldnt_update_community: 'Couldn\'t update Community.',
community_already_exists: 'Community already exists.',
community_moderator_already_exists: 'Community moderator already exists.',
community_follower_already_exists: 'Community follower already exists.',
community_user_already_banned: 'Community user already banned.',
couldnt_create_post: 'Couldn\'t create post.',
couldnt_like_post: 'Couldn\'t like post.',
couldnt_find_post: 'Couldn\'t find post.',
couldnt_get_posts: 'Couldn\'t get posts',
couldnt_update_post: 'Couldn\'t update post',
couldnt_save_post: 'Couldn\'t save post.',
no_slurs: 'No slurs.',
not_an_admin: 'Not an admin.',
site_already_exists: 'Site already exists.',
couldnt_update_site: 'Couldn\'t update site.',
couldnt_find_that_username_or_email: 'Couldn\'t find that username or email.',
password_incorrect: 'Password incorrect.',
passwords_dont_match: 'Passwords do not match.',
admin_already_created: 'Sorry, there\'s already an admin.',
user_already_exists: 'User already exists.',
couldnt_update_user: 'Couldn\'t update user.',
system_err_login: 'System error. Try logging out and back in.',
},
}

14
yarn.lock

@ -2,7 +2,7 @@
# yarn lockfile v1
"@babel/[email protected]^7.1.2", "@babel/[email protected]^7.3.1", "@babel/[email protected]^7.5.5":
"@babel/[email protected]^7.1.2", "@babel/[email protected]^7.3.1":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132"
integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ==
@ -1212,18 +1212,6 @@ [email protected]~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"
[email protected]^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-3.0.3.tgz#879ebe421685c70cc5cfa96191364a35ea7da742"
integrity sha512-1YuAogyQap0J6N4kM+6gAjZ6T7QWrp3xZCmSs0QedkNmgAKhj7FiQlCviHKl3IwbM6zJNgft4D7UDPWb1dTCMQ==
[email protected]^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/i18next-xhr-backend/-/i18next-xhr-backend-3.1.1.tgz#9221ba6911d466c38693fd43eb8ff10b48d3438a"
integrity sha512-Fui5puKb1pD+Z1+biwzA9jPQTvwOgz8SOkwu7yGRorCQraOgKxp86T310HoUM2CR9VV0MM2pJdntEQrgC45+RA==
dependencies:
"@babel/runtime" "^7.5.5"
[email protected]^17.0.9:
version "17.0.9"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-17.0.9.tgz#5f835e91a34fa5e7da1e5ae4c4586c81d7c4b17f"

Loading…
Cancel
Save