mirror of https://github.com/LemmyNet/lemmy
Adding support for internationalization / i18n (#189)
* Still not working * Starting to work on internationalization * Main done. * i18n translations first pass. * Localization testing mostly done. * Second front end pass. * Added a few more translations. * Adding back end translations.pull/283/head
parent
2db3b84b11
commit
0e00e77c14
@ -0,0 +1,33 @@
|
|||||||
|
import * as i18n from 'i18next';
|
||||||
|
import { getLanguage } from './utils';
|
||||||
|
import { en } from './translations/en';
|
||||||
|
import { de } from './translations/de';
|
||||||
|
|
||||||
|
// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
|
||||||
|
// TODO don't forget to add moment locales for new languages.
|
||||||
|
const resources = {
|
||||||
|
en: en,
|
||||||
|
de: de,
|
||||||
|
}
|
||||||
|
|
||||||
|
function format(value: any, format: any, lng: any) {
|
||||||
|
if (format === 'uppercase') return value.toUpperCase();
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
i18n
|
||||||
|
.init({
|
||||||
|
debug: true,
|
||||||
|
// load: 'languageOnly',
|
||||||
|
|
||||||
|
// initImmediate: false,
|
||||||
|
lng: getLanguage(),
|
||||||
|
fallbackLng: 'en',
|
||||||
|
resources,
|
||||||
|
interpolation: {
|
||||||
|
format: format
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export { i18n, resources };
|
@ -0,0 +1,124 @@
|
|||||||
|
export const de = {
|
||||||
|
translation: {
|
||||||
|
post: 'post',
|
||||||
|
remove_post: 'Remove Post',
|
||||||
|
no_posts: 'No Posts.',
|
||||||
|
create_a_post: 'Create a post',
|
||||||
|
create_post: 'Create Post',
|
||||||
|
number_of_posts:'{{count}} Posts',
|
||||||
|
posts: 'Posts',
|
||||||
|
related_posts: 'These posts might be related',
|
||||||
|
comments: 'Comments',
|
||||||
|
number_of_comments:'{{count}} Comments',
|
||||||
|
remove_comment: 'Remove Comment',
|
||||||
|
communities: 'Communities',
|
||||||
|
create_a_community: 'Create a community',
|
||||||
|
create_community: 'Create Community',
|
||||||
|
remove_community: 'Remove Community',
|
||||||
|
subscribed_to_communities:'Subscribed to <1>communities</1>',
|
||||||
|
trending_communities:'Trending <1>communities</1>',
|
||||||
|
list_of_communities: 'List of communities',
|
||||||
|
community_reqs: 'lowercase, underscores, and no spaces.',
|
||||||
|
edit: 'edit',
|
||||||
|
reply: 'reply',
|
||||||
|
cancel: 'Cancel',
|
||||||
|
unlock: 'unlock',
|
||||||
|
lock: 'lock',
|
||||||
|
link: 'link',
|
||||||
|
mod: 'mod',
|
||||||
|
mods: 'mods',
|
||||||
|
moderates: 'Moderates',
|
||||||
|
remove_as_mod: 'remove as mod',
|
||||||
|
appoint_as_mod: 'appoint as mod',
|
||||||
|
modlog: 'Modlog',
|
||||||
|
admin: 'admin',
|
||||||
|
admins: 'admins',
|
||||||
|
remove_as_admin: 'remove as admin',
|
||||||
|
appoint_as_admin: 'appoint as admin',
|
||||||
|
remove: 'remove',
|
||||||
|
removed: 'removed',
|
||||||
|
locked: 'locked',
|
||||||
|
reason: 'Reason',
|
||||||
|
mark_as_read: 'mark as read',
|
||||||
|
mark_as_unread: 'mark as unread',
|
||||||
|
delete: 'delete',
|
||||||
|
deleted: 'deleted',
|
||||||
|
restore: 'restore',
|
||||||
|
ban: 'ban',
|
||||||
|
ban_from_site: 'ban from site',
|
||||||
|
unban: 'unban',
|
||||||
|
unban_from_site: 'unban from site',
|
||||||
|
save: 'save',
|
||||||
|
unsave: 'unsave',
|
||||||
|
create: 'create',
|
||||||
|
username: 'Username',
|
||||||
|
email_or_username: 'Email or Username',
|
||||||
|
number_of_users:'{{count}} Users',
|
||||||
|
number_of_subscribers:'{{count}} Subscribers',
|
||||||
|
number_of_points:'{{count}} Points',
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Title',
|
||||||
|
category: 'Category',
|
||||||
|
subscribers: 'Subscribers',
|
||||||
|
both: 'Both',
|
||||||
|
saved: 'Saved',
|
||||||
|
unsubscribe: 'Unsubscribe',
|
||||||
|
subscribe: 'Subscribe',
|
||||||
|
prev: 'Prev',
|
||||||
|
next: 'Next',
|
||||||
|
sidebar: 'Sidebar',
|
||||||
|
sort_type: 'Sort type',
|
||||||
|
hot: 'Hot',
|
||||||
|
new: 'New',
|
||||||
|
top_day: 'Top day',
|
||||||
|
week: 'Week',
|
||||||
|
month: 'Month',
|
||||||
|
year: 'Year',
|
||||||
|
all: 'All',
|
||||||
|
top: 'Top',
|
||||||
|
api: 'API',
|
||||||
|
inbox: 'Inbox',
|
||||||
|
inbox_for: 'Inbox for <1>{{user}}</1>',
|
||||||
|
mark_all_as_read: 'mark all as read',
|
||||||
|
type: 'Type',
|
||||||
|
unread: 'Unread',
|
||||||
|
reply_sent: 'Reply sent',
|
||||||
|
search: 'Search',
|
||||||
|
overview: 'Overview',
|
||||||
|
view: 'View',
|
||||||
|
logout: 'Logout',
|
||||||
|
login_sign_up: 'Login / Sign up',
|
||||||
|
notifications_error: 'Desktop notifications not available in your browser. Try Firefox or Chrome.',
|
||||||
|
unread_messages: 'Unread Messages',
|
||||||
|
password: 'Password',
|
||||||
|
verify_password: 'Verify Password',
|
||||||
|
login: 'Login',
|
||||||
|
sign_up: 'Sign Up',
|
||||||
|
email: 'Email',
|
||||||
|
optional: 'Optional',
|
||||||
|
url: 'URL',
|
||||||
|
body: 'Body',
|
||||||
|
copy_suggested_title: 'copy suggested title: {{title}}',
|
||||||
|
community: 'Community',
|
||||||
|
expand_here: 'Expand here',
|
||||||
|
subscribe_to_communities: 'Subscribe to some <1>communities</1>.',
|
||||||
|
chat: 'Chat',
|
||||||
|
no_results: 'No results.',
|
||||||
|
setup: 'Setup',
|
||||||
|
lemmy_instance_setup: 'Lemmy Instance Setup',
|
||||||
|
setup_admin: 'Set Up Site Administrator',
|
||||||
|
your_site: 'your site',
|
||||||
|
modified: 'modified',
|
||||||
|
sponsors: 'Sponsors',
|
||||||
|
sponsors_of_lemmy: 'Sponsors of Lemmy',
|
||||||
|
sponsor_message: 'Lemmy is free, <1>open-source</1> software, meaning no advertising, monetizing, or venture capital, ever. Your donations directly support full-time development of the project. Thank you to the following people:',
|
||||||
|
support_on_patreon: 'Support on Patreon',
|
||||||
|
general_sponsors:'General Sponsors are those that pledged $10 to $39 to Lemmy.',
|
||||||
|
bitcoin: 'Bitcoin',
|
||||||
|
ethereum: 'Ethereum',
|
||||||
|
code: 'Code',
|
||||||
|
powered_by: 'Powered by',
|
||||||
|
landing_0: 'GERMAN 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>.',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,160 @@
|
|||||||
|
export const en = {
|
||||||
|
translation: {
|
||||||
|
post: 'post',
|
||||||
|
remove_post: 'Remove Post',
|
||||||
|
no_posts: 'No Posts.',
|
||||||
|
create_a_post: 'Create a post',
|
||||||
|
create_post: 'Create Post',
|
||||||
|
number_of_posts:'{{count}} Posts',
|
||||||
|
posts: 'Posts',
|
||||||
|
related_posts: 'These posts might be related',
|
||||||
|
comments: 'Comments',
|
||||||
|
number_of_comments:'{{count}} Comments',
|
||||||
|
remove_comment: 'Remove Comment',
|
||||||
|
communities: 'Communities',
|
||||||
|
create_a_community: 'Create a community',
|
||||||
|
create_community: 'Create Community',
|
||||||
|
remove_community: 'Remove Community',
|
||||||
|
subscribed_to_communities:'Subscribed to <1>communities</1>',
|
||||||
|
trending_communities:'Trending <1>communities</1>',
|
||||||
|
list_of_communities: 'List of communities',
|
||||||
|
community_reqs: 'lowercase, underscores, and no spaces.',
|
||||||
|
edit: 'edit',
|
||||||
|
reply: 'reply',
|
||||||
|
cancel: 'Cancel',
|
||||||
|
unlock: 'unlock',
|
||||||
|
lock: 'lock',
|
||||||
|
link: 'link',
|
||||||
|
mod: 'mod',
|
||||||
|
mods: 'mods',
|
||||||
|
moderates: 'Moderates',
|
||||||
|
remove_as_mod: 'remove as mod',
|
||||||
|
appoint_as_mod: 'appoint as mod',
|
||||||
|
modlog: 'Modlog',
|
||||||
|
admin: 'admin',
|
||||||
|
admins: 'admins',
|
||||||
|
remove_as_admin: 'remove as admin',
|
||||||
|
appoint_as_admin: 'appoint as admin',
|
||||||
|
remove: 'remove',
|
||||||
|
removed: 'removed',
|
||||||
|
locked: 'locked',
|
||||||
|
reason: 'Reason',
|
||||||
|
mark_as_read: 'mark as read',
|
||||||
|
mark_as_unread: 'mark as unread',
|
||||||
|
delete: 'delete',
|
||||||
|
deleted: 'deleted',
|
||||||
|
restore: 'restore',
|
||||||
|
ban: 'ban',
|
||||||
|
ban_from_site: 'ban from site',
|
||||||
|
unban: 'unban',
|
||||||
|
unban_from_site: 'unban from site',
|
||||||
|
save: 'save',
|
||||||
|
unsave: 'unsave',
|
||||||
|
create: 'create',
|
||||||
|
username: 'Username',
|
||||||
|
email_or_username: 'Email or Username',
|
||||||
|
number_of_users:'{{count}} Users',
|
||||||
|
number_of_subscribers:'{{count}} Subscribers',
|
||||||
|
number_of_points:'{{count}} Points',
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Title',
|
||||||
|
category: 'Category',
|
||||||
|
subscribers: 'Subscribers',
|
||||||
|
both: 'Both',
|
||||||
|
saved: 'Saved',
|
||||||
|
unsubscribe: 'Unsubscribe',
|
||||||
|
subscribe: 'Subscribe',
|
||||||
|
prev: 'Prev',
|
||||||
|
next: 'Next',
|
||||||
|
sidebar: 'Sidebar',
|
||||||
|
sort_type: 'Sort type',
|
||||||
|
hot: 'Hot',
|
||||||
|
new: 'New',
|
||||||
|
top_day: 'Top day',
|
||||||
|
week: 'Week',
|
||||||
|
month: 'Month',
|
||||||
|
year: 'Year',
|
||||||
|
all: 'All',
|
||||||
|
top: 'Top',
|
||||||
|
api: 'API',
|
||||||
|
inbox: 'Inbox',
|
||||||
|
inbox_for: 'Inbox for <1>{{user}}</1>',
|
||||||
|
mark_all_as_read: 'mark all as read',
|
||||||
|
type: 'Type',
|
||||||
|
unread: 'Unread',
|
||||||
|
reply_sent: 'Reply sent',
|
||||||
|
search: 'Search',
|
||||||
|
overview: 'Overview',
|
||||||
|
view: 'View',
|
||||||
|
logout: 'Logout',
|
||||||
|
login_sign_up: 'Login / Sign up',
|
||||||
|
login: 'Login',
|
||||||
|
sign_up: 'Sign Up',
|
||||||
|
notifications_error: 'Desktop notifications not available in your browser. Try Firefox or Chrome.',
|
||||||
|
unread_messages: 'Unread Messages',
|
||||||
|
password: 'Password',
|
||||||
|
verify_password: 'Verify Password',
|
||||||
|
email: 'Email',
|
||||||
|
optional: 'Optional',
|
||||||
|
expires: 'Expires',
|
||||||
|
url: 'URL',
|
||||||
|
body: 'Body',
|
||||||
|
copy_suggested_title: 'copy suggested title: {{title}}',
|
||||||
|
community: 'Community',
|
||||||
|
expand_here: 'Expand here',
|
||||||
|
subscribe_to_communities: 'Subscribe to some <1>communities</1>.',
|
||||||
|
chat: 'Chat',
|
||||||
|
no_results: 'No results.',
|
||||||
|
setup: 'Setup',
|
||||||
|
lemmy_instance_setup: 'Lemmy Instance Setup',
|
||||||
|
setup_admin: 'Set Up Site Administrator',
|
||||||
|
your_site: 'your site',
|
||||||
|
modified: 'modified',
|
||||||
|
sponsors: 'Sponsors',
|
||||||
|
sponsors_of_lemmy: 'Sponsors of Lemmy',
|
||||||
|
sponsor_message: 'Lemmy is free, <1>open-source</1> software, meaning no advertising, monetizing, or venture capital, ever. Your donations directly support full-time development of the project. Thank you to the following people:',
|
||||||
|
support_on_patreon: 'Support on Patreon',
|
||||||
|
general_sponsors:'General Sponsors are those that pledged $10 to $39 to Lemmy.',
|
||||||
|
crypto: 'Crypto',
|
||||||
|
bitcoin: 'Bitcoin',
|
||||||
|
ethereum: 'Ethereum',
|
||||||
|
code: 'Code',
|
||||||
|
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.',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue