From c4619b0ff7e0a8a4d0ac90a99255175bb3552b61 Mon Sep 17 00:00:00 2001 From: AdrienLSH Date: Fri, 2 Feb 2024 11:14:19 +0100 Subject: [PATCH] lang: translation of profile page --- frontend/static/js/api/profiles.js | 2 +- frontend/static/js/lang/en.json | 8 +++++++- frontend/static/js/lang/fr.json | 8 +++++++- frontend/static/js/views/ProfilePageView.js | 14 +++++++------- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/frontend/static/js/api/profiles.js b/frontend/static/js/api/profiles.js index 7c0d924..1a1eb54 100644 --- a/frontend/static/js/api/profiles.js +++ b/frontend/static/js/api/profiles.js @@ -32,7 +32,7 @@ class Profiles /** * * @param {String} username - * @returns {?Profile} + * @returns {?Promise} */ async getProfile(username) { diff --git a/frontend/static/js/lang/en.json b/frontend/static/js/lang/en.json index c5e42e4..b6ad271 100644 --- a/frontend/static/js/lang/en.json +++ b/frontend/static/js/lang/en.json @@ -29,5 +29,11 @@ "registerAlreadyAccount": "Already have an account?", "registerLogin": "Login", "404WindowTitle": "Not Found", - "SearchWindowTitle": "Search" + "SearchWindowTitle": "Search", + "profileAddFriend": "Ask Friend", + "profileRemoveFriend": "Remove Friend", + "profileDenyRequest": "Decline Friend", + "profileAcceptRequest": "Accept Friend", + "profileUnblock": "Unblock", + "profileBlock": "Block" } diff --git a/frontend/static/js/lang/fr.json b/frontend/static/js/lang/fr.json index 663c19c..be38190 100644 --- a/frontend/static/js/lang/fr.json +++ b/frontend/static/js/lang/fr.json @@ -29,5 +29,11 @@ "registerAlreadyAccount": "Déjà un compte?", "registerLogin": "Connexion", "404WindowTitle": "Pas trouvé", - "SearchWindowTitle": "Recherche" + "SearchWindowTitle": "Recherche", + "profileAddFriend": "Demander en ami", + "profileRemoveFriend": "Retirer l'ami", + "profileDenyRequest": "Refuser l'ami", + "profileAcceptRequest": "Accepter l'ami", + "profileUnblock": "Débloquer", + "profileBlock": "Bloquer" } diff --git a/frontend/static/js/views/ProfilePageView.js b/frontend/static/js/views/ProfilePageView.js index 88ab8f7..04e90cd 100644 --- a/frontend/static/js/views/ProfilePageView.js +++ b/frontend/static/js/views/ProfilePageView.js @@ -1,5 +1,5 @@ import AbstractView from "./abstracts/AbstractView.js"; -import { client } from "../index.js" +import { client, lang } from "../index.js" export default class extends AbstractView { constructor(params) { @@ -65,9 +65,9 @@ export default class extends AbstractView { this.blockButton(); }; if (this.profile.isBlocked) - block.textContent = "Deblock"; + block.textContent = lang.get('profileUnblock', 'Unblock'); else - block.textContent = "Block"; + block.textContent = lang.get('profileBlock', 'Block'); } } @@ -86,13 +86,13 @@ export default class extends AbstractView { friend.remove(); yes.id = "yes"; - yes.textContent = "Accept Friend"; + yes.textContent = lang.get('profileAcceptRequest', 'Accept Friend'); yes.onclick = async () => { client.notice.accept_friend(this.user_id); } no.id = "no"; - no.textContent = "Refuse Friend"; + no.textContent = lang.get('profileDenyRequest', 'Decline Friend'); no.onclick = async () => { client.notice.refuse_friend(this.user_id); } @@ -117,9 +117,9 @@ export default class extends AbstractView { this.friendButton(); }; if (this.profile.isFriend) - friend.textContent = "Remove Friend"; + friend.textContent = lang.get('profileRemoveFriend', 'Remove Friend'); else { - friend.textContent = "Ask Friend"; + friend.textContent = lang.get('profileAddFriend', 'Ask Friend'); } this.info.appendChild(friend); }