The person who created the room is the room owner and has special privileges, like the ability to lock and unlock the room.
- If the owner leaves the room, the second person to join assumes ownership. If they leave, the third person becomes owner, and so on.
- The room owner has a star icon next to their username in the participants dropdown.
-
+
+
-
Lock Room
-
If you are the room owner, you can lock and unlock the room by clicking the lock icon in the nav bar. When a room is locked, no other participants will be able to join.
Others can join this room using the following URL:
-
+
- Ok
+ {this.props.translations.welcomeModalCTA}
)
@@ -40,6 +40,7 @@ class Welcome extends Component {
Welcome.propTypes = {
roomId: PropTypes.string.isRequired,
close: PropTypes.func.isRequired,
+ translations: PropTypes.object.isRequired,
}
export default Welcome
diff --git a/client/src/i18n/en.json b/client/src/i18n/en.json
new file mode 100644
index 0000000..7fd36d1
--- /dev/null
+++ b/client/src/i18n/en.json
@@ -0,0 +1,37 @@
+{
+ "newRoomButton": "New Room",
+ "lockedRoom": "{username} locked the room",
+ "unlockedRoom": "{username} unlocked the room",
+ "agreement": "By using Darkwire, you are agreeing to our Acceptable Use Policy and Terms of Service",
+ "typePlaceholder": "Type here",
+ "aboutButton": "About",
+ "settingsButton": "Settings",
+ "settings": "Settings",
+ "aboutHeader": "About",
+ "copyButtonTooltip": "Copied",
+ "welcomeHeader": "Welcome to Darkwire v2.0",
+ "sentFile": "You sent {filename}",
+ "userJoined": "{username} joined",
+ "userLeft": "{username} left",
+ "userSentFile": "{username} sent you a file.",
+ "downloadFile": "Download {filename}",
+ "nameChange": "{oldUsername} changed their name to {newUsername}",
+ "settingsHeader": "Settings & Help",
+ "copyRoomHeader": "This room",
+ "languageDropdownHeader": "Language",
+ "roomOwnerHeader": "Room Ownership",
+ "roomOwnerText": "The person who created the room is the room owner and has special privileges, like the ability to lock and unlock the room. If the owner leaves the room, the second person to join assumes ownership. If they leave, the third person becomes owner, and so on. The room owner has a star icon next to their username in the participants dropdown.",
+ "lockRoomHeader": "Lock Room",
+ "lockRoomText": "If you are the room owner, you can lock and unlock the room by clicking the lock icon in the nav bar. When a room is locked, no other participants will be able to join.",
+ "slashCommandsHeader": "Slash Commands",
+ "slashCommandsText": "The following slash commands are available:",
+ "slashCommandsBullets": [
+ "changes username",
+ "performs an action",
+ "clears your message history",
+ "lists all commands"
+ ],
+ "sound": "Sound",
+ "welcomeModalCTA": "Ok",
+ "lockedRoomHeader": "This room is locked"
+}
\ No newline at end of file
diff --git a/client/src/i18n/fr.json b/client/src/i18n/fr.json
new file mode 100644
index 0000000..fdf2eaf
--- /dev/null
+++ b/client/src/i18n/fr.json
@@ -0,0 +1,37 @@
+{
+ "newRoomButton": "fr_New Room",
+ "lockedRoom": "fr_{username} locked the room",
+ "unlockedRoom": "fr_{username} unlocked the room",
+ "agreement": "fr_By using Darkwire, you are agreeing to our Acceptable Use Policy and Terms of Service",
+ "typePlaceholder": "fr_Type here",
+ "aboutButton": "fr_About",
+ "settingsButton": "fr_Settings",
+ "settings": "fr_Settings",
+ "aboutHeader": "fr_About",
+ "copyButtonTooltip": "fr_Copied",
+ "welcomeHeader": "fr_Welcome to Darkwire v2.0",
+ "sentFile": "fr_You sent {filename}",
+ "userJoined": "fr_{username} joined",
+ "userLeft": "fr_{username} left",
+ "userSentFile": "fr_{username} sent you a file.",
+ "downloadFile": "fr_Download {filename}",
+ "nameChange": "fr_{oldUsername} changed their name to {newUsername}",
+ "settingsHeader": "fr_Settings & Help",
+ "copyRoomHeader": "fr_This room",
+ "languageDropdownHeader": "fr_Language",
+ "roomOwnerHeader": "fr_Room Ownership",
+ "roomOwnerText": "fr_The person who created the room is the room owner and has special privileges, like the ability to lock and unlock the room. If the owner leaves the room, the second person to join assumes ownership. If they leave, the third person becomes owner, and so on. The room owner has a star icon next to their username in the participants dropdown.",
+ "lockRoomHeader": "fr_Lock Room",
+ "lockRoomText": "fr_If you are the room owner, you can lock and unlock the room by clicking the lock icon in the nav bar. When a room is locked, no other participants will be able to join.",
+ "slashCommandsHeader": "fr_Slash Commands",
+ "slashCommandsText": "fr_The following slash commands are available:",
+ "slashCommandsBullets": [
+ "fr_changes username",
+ "fr_performs an action",
+ "fr_clears your message history",
+ "fr_lists all commands"
+ ],
+ "sound": "fr_Sound",
+ "welcomeModalCTA": "fr_Ok",
+ "lockedRoomHeader": "fr_This room is locked"
+}
\ No newline at end of file
diff --git a/client/src/i18n/index.js b/client/src/i18n/index.js
new file mode 100644
index 0000000..ab37ac2
--- /dev/null
+++ b/client/src/i18n/index.js
@@ -0,0 +1,11 @@
+import en from './en';
+import fr from './fr';
+
+const languagesMap = {
+ en,
+ fr,
+}
+
+export function getTranslations(language) {
+ return languagesMap[language];
+}
\ No newline at end of file
diff --git a/client/src/reducers/app.js b/client/src/reducers/app.js
index 703e9b8..8823468 100644
--- a/client/src/reducers/app.js
+++ b/client/src/reducers/app.js
@@ -1,3 +1,8 @@
+import Cookie from 'js-cookie';
+import {getTranslations} from 'i18n';
+
+const language = Cookie.get('language') || 'en';
+
const initialState = {
modalComponent: null,
scrolledToBottom: true,
@@ -5,6 +10,8 @@ const initialState = {
unreadMessageCount: 0,
soundIsEnabled: true,
socketConnected: false,
+ language,
+ translations: getTranslations(language)
}
const app = (state = initialState, action) => {
@@ -45,6 +52,12 @@ const app = (state = initialState, action) => {
...state,
socketConnected: action.payload,
}
+ case 'CHANGE_LANGUAGE':
+ return {
+ ...state,
+ language: action.payload,
+ translations: getTranslations(action.payload)
+ }
default:
return state
}
diff --git a/client/yarn.lock b/client/yarn.lock
index 3a8fdb1..7d1a84d 100644
--- a/client/yarn.lock
+++ b/client/yarn.lock
@@ -6000,6 +6000,11 @@ js-base64@^2.1.8:
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121"
integrity sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==
+js-cookie@^2.2.0:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.0.tgz#1b2c279a6eece380a12168b92485265b35b1effb"
+ integrity sha1-Gywnmm7s44ChIWi5JIUmWzWx7/s=
+
js-levenshtein@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d"