Skip to content

Commit

Permalink
chore(l10n,Controller): Changed the wording and added new translations
Browse files Browse the repository at this point in the history
  • Loading branch information
zak39 committed Jul 16, 2024
1 parent 33f6c98 commit 1ea5e8a
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 26 deletions.
6 changes: 6 additions & 0 deletions l10n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ OC.L10N.register(
'The content of your file is invalid. Header does not contain the desired values. Two columns are required, with the following header names and values:<br>- "user": the user\'s username or e-mail address<br>- "role": the user\'s role ("u" or "user" for a user and "wm" for a workspace manager)': 'The content of your file is invalid. Header does not contain the desired values. Two columns are required, with the following header names and values:<br>- "user": the user\'s username or e-mail address<br>- "role": the user\'s role ("u" or "user" for a user and "wm" for a workspace manager)',
'This group already exists. Please, change the name': 'This group already exists. Please, change the name',
'You aren\'t allowed to access into this application !': 'You aren\'t allowed to access into this application !',
'Only the following values are allowed: <b>%1$s</b><br><br>- "wm": to define the user as a workspace manager.<br>- "u" or "user": to define the user as a simple user.<br><br>Check the role for these users:<br>%2$s': 'Only the following values are allowed: <b>%1$s</b><br><br>- "wm": to define the user as a workspace manager.<br>- "u" or "user": to define the user as a simple user.<br><br>Check the role for these users:<br>%2$s',
'Error in CSV file content': 'Error in CSV file content',
'return to home': 'return to home',
'Invalid separator for CSV file': 'Invalid separator for CSV file',
Expand All @@ -38,6 +39,11 @@ OC.L10N.register(
'Error to rename space': 'Error to rename space',
'The space name already exist. We cannot rename with this name.': 'The space name already exist. We cannot rename with this name.',
'User doesn\'t exist': 'User doesn\'t exist',
'Error: unknown users': 'Error: unknown users',
'Error: unknown role': 'Error: unknown role',
'role': 'role',
'has the': 'has the',
'- <b>%1$s</b> has the <b>%2$s</b> role': '- <b>%1$s</b> has the <b>%2$s</b> role',
'The users of this CSV file are unknown and can not be imported. Check the following users and repeat the process:<br>': 'The users of this CSV file are unknown and can not be imported. Check the following users and repeat the process:<br>',
'You csv file must follow this structure:': 'You csv file must follow this structure:',
'New space': 'Create a Workspace',
Expand Down
6 changes: 5 additions & 1 deletion l10n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ OC.L10N.register(
'The %s email address is duplicated in your instance. Impossible to know which users choice or maybe is an error.': 'L\'adresse email %s est dupliquée dans votre instance. Impossible de savoir quels utilisateurs choisir ou peut-être qu\'il y a une erreur.',
'or': 'ou',
'Create group': 'Créer un groupe',
'Error in CSV file content': 'Erreur dans le format du fichier .csv',
'Error in CSV file content': 'Erreur dans le contenu du fichier CSV',
'Duplication of groups': 'Duplication des groupes',
'Invalid separator for CSV file': 'Séparateur incorrect pour le fichier CSV',
'Your CSV file must use a comma (",") as separator': 'Votre fichier CSV doit utiliser une virgule (",") comme séparateur.',
Expand All @@ -31,6 +31,10 @@ OC.L10N.register(
'Delete user': "Retirer de l'espace de travail",
'Email': 'Email',
'User doesn\'t exist': 'Des utilisateurs n\'existent pas',
'Only the following values are allowed: <b>%1$s</b><br><br>- "wm": to define the user as a workspace manager.<br>- "u" or "user": to define the user as a simple user.<br><br>Check the role for these users:<br>%2$s': 'Seule les valeurs suivantes sont autorisées pour le champs "role": <b>%1$s</b><br><br>- "wm": pour définir le rôle de gestionnaire d\'espace.<br>- "u" ou "user": pour définir le rôle d\'utilisateur.<br><br>Veuillez vérifier les rôles utilisateurs suivants:<br>%2$s',
'Error: unknown role': 'Erreur: le rôle indiqué n\'est pas reconnu',
'Error: unknown users': 'Erreur: utilisateurs non reconnus',
'- <b>%1$s</b> has the <b>%2$s</b> role': '- <b>%1$s</b> a le rôle <b>%2$s</b>',
'The users of this CSV file are unknown and can not be imported. Check the following users and repeat the process:<br>': 'Les utilisateurs de ce fichier CSV ne sont pas reconnus et ne peuvent pas être importés. Veuillez vérifier les utilisateurs suivants et répéter l\'opération :<br>',
'Settings': 'Paramètres',
'This group already exists. Please, change the name': 'Ce groupe existe déjà. Changez le nom, s\'il vous plaît.',
Expand Down
6 changes: 5 additions & 1 deletion l10n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"Role" : "Role",
"Convert group folders": "Convertir",
"Select groupfolders to convert in workspace": "Selectionner les dossiers du groupe à convertir en espace projet",
"Error in CSV file content": "Erreur dans le format du fichier .csv",
"Error in CSV file content": "Erreur dans le contenu du fichier CSV",
"Convert in spaces": "Convertir en espace projet",
"No username matches your current entry.": "Aucun nom d'utilisateur ne correspond à votre saisie actuelle",
"Invalid separator for CSV file": "Séparateur incorrect pour le fichier CSV",
Expand All @@ -43,6 +43,10 @@
"or": "ou",
"Please specify a name.": "S'il vous plaît, spécifier un nom",
"Rename space": "Renommer l'Espace Projet",
"Error: unknown users": "Erreur: utilisateurs non reconnus",
"Error: unknown role": "Erreur: le rôle indiqué n'est pas reconnu",
"Only the following values are allowed: <b>%1$s</b><br><br>- \"wm\": to define the user as a workspace manager.<br>- \"u\" or \"user\": to define the user as a simple user.<br><br>Check the role for these users:<br>%2$s": "Seule les valeurs suivantes sont autorisées pour le champs \"role\": <b>%1$s</b><br><br>- \"wm\": pour définir le rôle de gestionnaire d'espace.<br>- \"u\" ou \"user\": pour définir le rôle d'utilisateur.<br><br>Veuillez vérifier les rôles utilisateurs suivants:<br>%2$s",
"- <b>%1$s</b> has the <b>%2$s</b> role": "- <b>%1$s</b> a le rôle <b>%2$s</b>",
"The users of this CSV file are unknown and can not be imported. Check the following users and repeat the process:<br>": "Les utilisateurs de ce fichier CSV ne sont pas reconnus et ne peuvent pas être importés. Veuillez vérifier les utilisateurs suivants et répéter l'opération :<br>",
"Email address doesn't unique": "L'adresse email n'est pas unique",
"The %s email address is duplicated in your instance. Impossible to know which users choice or maybe is an error.": "L'adresse email %s est dupliquée dans votre instance. Impossible de savoir quels utilisateurs choisir ou peut-être qu'il y a une erreur.",
Expand Down
59 changes: 35 additions & 24 deletions lib/Controller/FileCSVController.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function ($name) {
$errorMessage = $this->translate->t('The users of this CSV file are unknown and can not be imported. Check the following users and repeat the process:<br>');
$errorMessage .= $usersUnknown;
throw new UserDoesntExistException(
$this->translate->t('Error'),
$this->translate->t('Error: unknown users'),
$errorMessage,
Http::STATUS_FORBIDDEN
);
Expand All @@ -188,22 +188,25 @@ function ($name) {
fn ($user) => !in_array($user->role, Values::ROLES)
);

$message = sprintf('Only the following values are allowed : <b>%s</b><br><br>', implode(', ', Values::ROLES));
$message .= '- "wm" : To define the user as a workspace manager.<br>';
$message .= '- "u" or "user" : To define the user as a simple user.<br><br>';
$message .= sprintf('Check the role for these users :<br>%s',
implode(
'<br>',
array_map(
fn ($user) => "- <b>$user->uid</b> has the <b>$user->role</b> role",
$usersBadRole
)
$message = 'Only the following values are allowed: <b>%1$s</b><br><br>'
. '- "wm": to define the user as a workspace manager.<br>'
. '- "u" or "user": to define the user as a simple user.<br><br>'
. 'Check the role for these users:<br>%2$s';

$usersBadRoleStringify = implode(
'<br>',
array_map(
fn ($user) => $this->translate->t('- <b>%1$s</b> has the <b>%2$s</b> role', [$user->uid, $user->role]),
$usersBadRole
)
);

throw new InvalidCsvFormatException(
$this->translate->t('Error in the role value'),
$this->translate->t($message)
$this->translate->t('Error: unknown role'),
$this->translate->t($message, [
implode(', ', Values::ROLES),
$usersBadRoleStringify
])
);
}

Expand Down Expand Up @@ -352,7 +355,7 @@ function ($name) {
$errorMessage = $this->translate->t('The users of this CSV file are unknown and can not be imported. Check the following users and repeat the process:<br>');
$errorMessage .= $usersUnknown;
throw new UserDoesntExistException(
$this->translate->t('Error'),
$this->translate->t('Error: unknown users'),
$errorMessage,
Http::STATUS_FORBIDDEN
);
Expand All @@ -365,18 +368,26 @@ function ($name) {
fn ($user) => !in_array($user->role, Values::ROLES)
);

$message = sprintf('Only the following values are allowed : <b>%s</b><br><br>', implode(', ', Values::ROLES));
$message .= '- "wm" : To define the user as a workspace manager.<br>';
$message .= '- "u" or "user" : To define the user as a simple user.<br><br>';
$message .= sprintf('Check the role for these users :<br>%s',
implode(
'<br>',
array_map(
fn ($user) => "- <b>$user->uid</b> has the <b>$user->role</b> role",
$usersBadRole
)
$message = 'Only the following values are allowed: <b>%1$s</b><br><br>'
. '- "wm": to define the user as a workspace manager.<br>'
. '- "u" or "user": to define the user as a simple user.<br><br>'
. 'Check the role for these users:<br>%2$s';

$usersBadRoleStringify = implode(
'<br>',
array_map(
fn ($user) => $this->translate->t('- <b>%1$s</b> has the <b>%2$s</b> role', [$user->uid, $user->role]),
$usersBadRole
)
);

throw new InvalidCsvFormatException(
$this->translate->t('Error: unknown role'),
$this->translate->t($message, [
implode(', ', Values::ROLES),
$usersBadRoleStringify
])
);
}

$data = [];
Expand Down

0 comments on commit 1ea5e8a

Please sign in to comment.