Added i18next-loader to webpack

This commit is contained in:
Dylan 2022-07-17 12:12:12 +09:30
parent 5ec542143c
commit ef31851554
7 changed files with 1378 additions and 809 deletions

693
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@
"author": "Ajay Bura",
"license": "MIT",
"dependencies": {
"@alienfast/i18next-loader": "^1.1.4",
"@fontsource/inter": "^4.5.11",
"@fontsource/roboto": "^4.5.7",
"@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.8.tgz",
@ -26,11 +27,10 @@
"file-saver": "^2.0.5",
"flux": "^4.0.3",
"formik": "^2.2.9",
"html-react-parser": "^1.4.14",
"html-react-parser": "^2.0.0",
"i18next": "^21.8.9",
"i18next-browser-languagedetector": "^6.1.4",
"i18next-http-backend": "^1.4.1",
"html-react-parser": "^2.0.0",
"katex": "^0.15.6",
"linkify-html": "^4.0.0-beta.5",
"linkifyjs": "^4.0.0-beta.5",

View file

@ -1,4 +1,5 @@
{
"translation": {
"common": {
"close": "Close",
"open": "Open",
@ -452,28 +453,25 @@
"home": "Home"
}
},
"Molecules":{
"ConfirmDialog":{
"Molecules": {
"ConfirmDialog": {
"cancel": "Cancel"
},
"ReusableDialog":
{
"ReusableDialog": {
"close_tooltip": "Close"
},
"FollowingMembers":{
"FollowingMembers": {
"users_following_one": "<bold>{{user_one}}</bold> is following the conversation",
"users_following_two": "<bold>{{user_one}}</bold> and <bold>{{user_two}}</bold> are following the conversation",
"users_following_three": "<bold>{{user_one}}</bold>, <bold>{{user_two}}</bold>, and <bold>{{user_three}}</bold> are following the conversation",
"users_following_other": "<bold>{{user_one}}</bold>, <bold>{{user_two}}</bold>, <bold>{{user_three}}</bold> and {{other_count}} others are following the conversation"
},
"ImageUpload":
{
"ImageUpload": {
"prompt": "Upload",
"cancel": "Cancel",
"remove": "Remove"
},
"ExportE2ERoomKeys":
{
"ExportE2ERoomKeys": {
"getting_keys": "Getting keys...",
"encrypting_keys": "Encrypting Keys...",
"password_does_not_match": "Password does not match.",
@ -481,8 +479,7 @@
"export_failed": "Failed to export keys. Please try again.",
"button_text": "Export"
},
"ImportE2ERoomKeys":
{
"ImportE2ERoomKeys": {
"decrypting_file": "Decrypting file...",
"decrypting_messages": "Decrypting messages...",
"import_success": "Successfully imported all keys",
@ -490,14 +487,13 @@
"import_keys_button": "Import Keys",
"decrypt_button": "Decrypt"
},
"Media":{
"Media": {
"open_new_tab": "Open in new tab",
"download": "Download",
"play_audio": "Play audio",
"play_video": "Play video"
},
"Message":
{
"Message": {
"message_deleted": "*** This message has been deleted ***",
"unable_to_load_reply": "*** Unable to load reply ***",
"unknown_user": "** Unknown user **",
@ -518,8 +514,7 @@
"delete_message_confirmation": "Are you sure that you want to delete this message?",
"delete_message_button": "Delete"
},
"PopupWindow":
{
"PopupWindow": {
"close_tooltip": "Back"
},
"PowerLevelSelector": {
@ -536,22 +531,19 @@
"unpublish_alias": "Unpublish",
"delete_alias": "Delete",
"main_alias": "Main",
"publish_to_room_directory":
{
"publish_to_room_directory": {
"title": "Publish to room directory",
"publish_room_message": "Publish this room to the {{homeserver}} publish directory?",
"publish_space_message": "Publish this space to the {{homeserver}} publish directory?"
},
"published_addresses":
{
"published_addresses": {
"title": "Published addresses",
"none": "No published addresses",
"no_main_address": "No main address (select one from below)",
"message_room": "Published addresses can be used by anyone on any server to join your room. To publish an address, it needs to be set as a local address first.",
"message_space": "Published addresses can be used by anyone on any server to join your space. To publish an address, it needs to be set as a local address first."
},
"local_addresses":
{
"local_addresses": {
"title": "Local addresses",
"none": "No local addresses",
"message_room": "Set local addresses for this room so users can find this room through your homeserver.",
@ -562,10 +554,9 @@
"placeholder_space": "my_space_address",
"hide": "Hide local addresses",
"view": "View local addresses"
}
},
"RoomEncryption":{
"RoomEncryption": {
"encryption_public_room_message": "It is not recommended to add encryption in public room. Anyone can find and join public rooms, so anyone should be able to read messages in them.",
"encryption_message": "Once enabled, encryption for a room cannot be disabled. Messages sent in an encrypted room cannot be seen by the server, only by the participants of the room. Enabling encryption may prevent many bots and bridges from working correctly",
"encryption_cannot_be_disabled": "Once enabled, encryption cannot be disabled.",
@ -573,7 +564,6 @@
"enable_encryption_prompt": "Enable Encryption",
"enable_encryption_button": "Enable",
"continue_button": "Continue"
},
"RoomHistoryVisibility": {
"world_readable": "Anyone (including guests)",
@ -594,14 +584,13 @@
"banned": "Banned",
"search_placeholder": "Search for name"
},
"RoomNotification":
{
"RoomNotification": {
"default": "Global",
"all_messages": "All messages",
"mentions_and_keywords": "Mentions & Keywords",
"mute": "Mute"
},
"RoomOptions":{
"RoomOptions": {
"title": "Options for {{room_name}}",
"leave": {
"title": "Leave room",
@ -612,8 +601,7 @@
"notifications_heading": "Notifications",
"invite": "Invite"
},
"RoomPermissions":
{
"RoomPermissions": {
"default_role": {
"name": "Default role",
"description": "Set default role for all members"
@ -622,7 +610,7 @@
"name": "Send messages",
"description": "Set minimum power level to send messages in a room"
},
"reactions":{
"reactions": {
"name": "Send reactions",
"description": "Set minimum power level to send reactions in a room"
},
@ -630,11 +618,11 @@
"name": "Delete messages sent by others",
"description": "Set minumum power level to delete messages in a room"
},
"notifications":{
"notifications": {
"name": "Ping room",
"description": "Set minimum power level to ping room"
},
"manage_rooms":{
"manage_rooms": {
"name": "Manage rooms in space",
"description": "Set minimum power level to manage rooms in space"
},
@ -698,8 +686,7 @@
"name": "Modify widgets",
"description": "Set minimum power level to modify room widgets"
},
"groups":
{
"groups": {
"general": "General permissions",
"manage_members": "Manage members permissions",
"room": "Room profile permissions",
@ -765,7 +752,7 @@
"leave_space_confirmation": "Are you sure that you want to leave the {{space}} space?",
"leave_space_confirm": "Leave",
"invite": "Invite",
"manage_rooms":"Manage rooms",
"manage_rooms": "Manage rooms",
"settings": "Settings",
"leave": "Leave"
},
@ -773,4 +760,5 @@
"login_with": "Login with {{idp_name}}"
}
}
}
}

1
public/locales/index.js Normal file
View file

@ -0,0 +1 @@
//root pointer

View file

@ -1,11 +1,9 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-http-backend'
import resources from '../../public/locales';
i18n
.use(Backend)
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
.use(LanguageDetector)
// pass the i18n instance to react-i18next.
@ -13,10 +11,12 @@ i18n
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
resources,
debug: true,
fallbackLng: 'en',
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
}
},
});
export default i18n;

View file

@ -47,6 +47,10 @@ module.exports = {
{
test: /\.svg$/,
type: 'asset/inline',
},
{
test: /locales/,
loader: '@alienfast/i18next-loader'
}
],
},

View file

@ -21,7 +21,8 @@ module.exports = merge(common, {
'css-loader',
'sass-loader',
],
},
}
],
},
});