Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce translation message categories #142

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ public static function onSampleDataInstall($event)
$poll = new Poll();
$poll->scenario = Poll::SCENARIO_CREATE;

$poll->question = Yii::t('PollsModule.events', 'Location of the next meeting');
$poll->description = Yii::t('PollsModule.events', "Right now, we are in the planning stages for our next meetup and we would like to know from you, where you would like to go?");
$poll->question = Yii::t('PollsModule.base', 'Location of the next meeting');
$poll->description = Yii::t('PollsModule.base', "Right now, we are in the planning stages for our next meetup and we would like to know from you, where you would like to go?");
$poll->newAnswers = [
Yii::t('PollsModule.events', "To Daniel"),
Yii::t('PollsModule.events', "Club A Steakhouse"),
Yii::t('PollsModule.events', "Pisillo Italian Panini"),
Yii::t('PollsModule.base', "To Daniel"),
Yii::t('PollsModule.base', "Club A Steakhouse"),
Yii::t('PollsModule.base', "Pisillo Italian Panini"),
];
$poll->content->container = $space;
$poll->allow_multiple = Yii::$app->request->post('allowMultiple', 0);
Expand All @@ -140,7 +140,7 @@ public static function onSampleDataInstall($event)
$poll->vote([2]);

$comment = new \humhub\modules\comment\models\Comment();
$comment->message = Yii::t('PollsModule.events', "Why don't we go to Bemelmans Bar?");
$comment->message = Yii::t('PollsModule.base', "Why don't we go to Bemelmans Bar?");
$comment->object_model = $poll->className();
$comment->object_id = $poll->getPrimaryKey();
$comment->save();
Expand All @@ -152,7 +152,7 @@ public static function onSampleDataInstall($event)
$poll->vote([3]);

$comment = new \humhub\modules\comment\models\Comment();
$comment->message = Yii::t('PollsModule.events', "Again? ;Weary;");
$comment->message = Yii::t('PollsModule.base', "Again? ;Weary;");
$comment->object_model = $poll->className();
$comment->object_id = $poll->getPrimaryKey();
$comment->save();
Expand Down
4 changes: 2 additions & 2 deletions activities/NewVote.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class NewVote extends BaseActivity implements ConfigurableActivityInterface
*/
public function getTitle()
{
return Yii::t('PollsModule.activities', 'Polls');
return Yii::t('PollsModule.base', 'Polls');
}

/**
* @inheritdoc
*/
public function getDescription()
{
return Yii::t('PollsModule.activities', 'Whenever someone participates in a poll.');
return Yii::t('PollsModule.base', 'Whenever someone participates in a poll.');
}

}
4 changes: 2 additions & 2 deletions activities/views/newVote.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use yii\helpers\Html;

echo Yii::t('PollsModule.views_activities_PollAnswered', '{userName} answered the {question}.', array(
echo Yii::t('PollsModule.base', '{userName} answered the {question}.', array(
'{userName}' => '<strong>' . Html::encode($originator->displayName) . '</strong>',
'{question}' => $this->context->getContentInfo($source)
));
?>
?>
18 changes: 9 additions & 9 deletions controllers/PollController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ public function actionEdit()
$model->scenario = Poll::SCENARIO_EDIT;

if (!$model->content->canEdit() || $model->closed) {
throw new HttpException(403, Yii::t('PollsModule.controllers_PollController', 'Access denied!'));
throw new HttpException(403, Yii::t('PollsModule.base', 'Access denied!'));
}

if ($model->load($request->post())) {
if ($wasAnonymous && !$model->anonymous) {
//This is only possible per post hacks... just to get sure...
throw new HttpException(403, Yii::t('PollsModule.controllers_PollController', 'Access denied!'));
throw new HttpException(403, Yii::t('PollsModule.base', 'Access denied!'));
}
Yii::$app->response->format = 'json';
$result = [];
Expand Down Expand Up @@ -123,7 +123,7 @@ public function setClosed($id, $closed)
$model->scenario = Poll::SCENARIO_CLOSE;

if (!$model->content->canEdit()) {
throw new HttpException(403, Yii::t('PollsModule.controllers_PollController', 'Access denied!'));
throw new HttpException(403, Yii::t('PollsModule.base', 'Access denied!'));
}

$model->closed = $closed;
Expand Down Expand Up @@ -154,7 +154,7 @@ public function actionAnswer()
}

if (count($votes) > 1 && !$poll->allow_multiple) {
throw new HttpException(401, Yii::t('PollsModule.controllers_PollController', 'Voting for multiple answers is disabled!'));
throw new HttpException(401, Yii::t('PollsModule.base', 'Voting for multiple answers is disabled!'));
}

$poll->vote($votes);
Expand All @@ -181,13 +181,13 @@ public function actionUserListResults()
$poll = $this->getPollByParameter();

if ($poll->anonymous) {
throw new HttpException(401, Yii::t('PollsModule.controllers_PollController', 'Anonymous poll!'));
throw new HttpException(401, Yii::t('PollsModule.base', 'Anonymous poll!'));
}

$answerId = (int) Yii::$app->request->get('answerId', '');
$answer = PollAnswer::findOne(['id' => $answerId]);
if ($answer == null || $poll->id != $answer->poll_id) {
throw new HttpException(401, Yii::t('PollsModule.controllers_PollController', 'Invalid answer!'));
throw new HttpException(401, Yii::t('PollsModule.base', 'Invalid answer!'));
}

$query = User::find();
Expand All @@ -196,7 +196,7 @@ public function actionUserListResults()
$query->andWhere(['poll_answer_user.poll_answer_id' => $answerId]);
$query->orderBy('poll_answer_user.created_at DESC');

$title = Yii::t('PollsModule.controllers_PollController', "Users voted for: <strong>{answer}</strong>", ['{answer}' => Html::encode($answer->answer)]);
$title = Yii::t('PollsModule.base', "Users voted for: <strong>{answer}</strong>", ['{answer}' => Html::encode($answer->answer)]);

return $this->renderAjaxContent(UserListBox::widget(['query' => $query, 'title' => $title]));
}
Expand Down Expand Up @@ -227,11 +227,11 @@ private function getPollByParameter()
$poll = Poll::find()->contentContainer($this->contentContainer)->readable()->where(['poll.id' => $pollId])->one();

if (!$poll) {
throw new HttpException(401, Yii::t('PollsModule.controllers_PollController', 'Could not load poll!'));
throw new HttpException(401, Yii::t('PollsModule.base', 'Could not load poll!'));
}

if (!$poll->content->canView()) {
throw new HttpException(401, Yii::t('PollsModule.controllers_PollController', 'You have insufficient permissions to perform that operation!'));
throw new HttpException(401, Yii::t('PollsModule.base', 'You have insufficient permissions to perform that operation!'));
}

return $poll;
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.3.7 (Unreleased)
--------------------------
- Enh #142: Reduce translation message categories

1.3.6 (September 13, 2024)
--------------------------
- Enh #137: Use PHP CS Fixer
Expand Down
6 changes: 0 additions & 6 deletions messages/am/activities.php

This file was deleted.

66 changes: 54 additions & 12 deletions messages/am/base.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,55 @@
<?php

return [
'Cancel' => 'ይቅር',
'Save' => 'አስቀምጥ',
'Allows the user to create polls' => '',
'Allows to start polls.' => '',
'Answers' => '',
'At least one answer is required' => '',
'Create poll' => '',
'Polls' => '',
'{n,plural,=1{# {htmlTagBegin}vote{htmlTagEnd}}other{# {htmlTagBegin}votes{htmlTagEnd}}}' => '',
];
return array (
'<b>There are no polls yet!</b>' => '',
'<b>There are no polls yet!</b><br>Be the first and create one...' => '',
'<strong>Note:</strong> The result is hidden until the poll is closed by a moderator.' => '',
'Access denied!' => 'ትዕዛዝዎ ተቀባይነት አላገኘም!',
'Add answer...' => '',
'Again? ;Weary;' => '',
'Allows the user to create polls' => '',
'Allows to start polls.' => '',
'Anonymous' => '',
'Anonymous Votes?' => '',
'Anonymous poll!' => '',
'Answers' => '',
'Ask' => '',
'Asked by me' => '',
'At least one answer is required' => '',
'Cancel' => 'ይቅር',
'Closed' => '',
'Club A Steakhouse' => '',
'Complete Poll' => '',
'Could not load poll!' => '',
'Create poll' => '',
'Description' => '',
'Display answers in random order?' => '',
'Edit answer (empty answers will be removed)...' => '',
'Edit your poll question...' => '',
'Hide results until poll is closed?' => '',
'Invalid answer!' => '',
'Location of the next meeting' => '',
'Multiple answers per user' => '',
'No answered yet' => '',
'Only private polls' => '',
'Only public polls' => '',
'Pisillo Italian Panini' => '',
'Please specify at least {min} answers!' => '',
'Poll' => '',
'Polls' => '',
'Question' => '',
'Reopen Poll' => '',
'Reset my vote' => '',
'Right now, we are in the planning stages for our next meetup and we would like to know from you, where you would like to go?' => '',
'Save' => 'አስቀምጥ',
'To Daniel' => '',
'Users voted for: <strong>{answer}</strong>' => '',
'Vote' => '',
'Voting for multiple answers is disabled!' => '',
'Whenever someone participates in a poll.' => '',
'Why don\'t we go to Bemelmans Bar?' => '',
'You have insufficient permissions to perform that operation!' => '',
'and {count} more vote for this.' => '',
'votes' => '',
'{n,plural,=1{# {htmlTagBegin}vote{htmlTagEnd}}other{# {htmlTagBegin}votes{htmlTagEnd}}}' => '',
'{userName} answered the {question}.' => '',
);
10 changes: 0 additions & 10 deletions messages/am/controllers_PollController.php

This file was deleted.

11 changes: 0 additions & 11 deletions messages/am/events.php

This file was deleted.

10 changes: 0 additions & 10 deletions messages/am/models_Poll.php

This file was deleted.

5 changes: 0 additions & 5 deletions messages/am/views_activities_PollAnswered.php

This file was deleted.

5 changes: 0 additions & 5 deletions messages/am/widgets_PollFormWidget.php

This file was deleted.

13 changes: 0 additions & 13 deletions messages/am/widgets_views_entry.php

This file was deleted.

12 changes: 0 additions & 12 deletions messages/am/widgets_views_pollForm.php

This file was deleted.

10 changes: 0 additions & 10 deletions messages/am/widgets_views_stream.php

This file was deleted.

5 changes: 0 additions & 5 deletions messages/an/activities.php

This file was deleted.

69 changes: 57 additions & 12 deletions messages/an/base.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,58 @@
<?php

return [
'Allows to start polls.' => 'Permitir iniciar enqüestas.',
'Answers' => 'Respuestas',
'Cancel' => 'Cancelar',
'Polls' => 'Enqüestas',
'Save' => 'Alzar',
'Allows the user to create polls' => '',
'At least one answer is required' => '',
'Create poll' => '',
'{n,plural,=1{# {htmlTagBegin}vote{htmlTagEnd}}other{# {htmlTagBegin}votes{htmlTagEnd}}}' => '',
];
return array (
'<b>There are no polls yet!</b>' => '',
'<b>There are no polls yet!</b><br>Be the first and create one...' => '',
'<strong>Note:</strong> The result is hidden until the poll is closed by a moderator.' => '',
'Access denied!' => 'Acceso denegado!',
'Add answer...' => '',
'Again? ;Weary;' => '',
'Allows the user to create polls' => '',
'Allows to start polls.' => 'Permitir iniciar enqüestas.',
'Anonymous' => '',
'Anonymous Votes?' => '',
'Anonymous poll!' => '',
'Answers' => 'Respuestas',
'Ask' => 'Preguntar',
'Asked by me' => '',
'At least one answer is required' => '',
'Cancel' => 'Cancelar',
'Closed' => 'Zarrada',
'Club A Steakhouse' => '',
'Complete Poll' => 'Enqüesta completa',
'Could not load poll!' => '',
'Create poll' => '',
'Description' => 'Descripción',
'Display answers in random order?' => '',
'Edit answer (empty answers will be removed)...' => '',
'Edit your poll question...' => '',
'Hide results until poll is closed?' => '',
'Invalid answer!' => '',
'Location of the next meeting' => '',
'Multiple answers per user' => 'Multiples respuestas per usuario',
'No answered yet' => '',
'Only private polls' => '',
'Only public polls' => '',
'Pisillo Italian Panini' => '',
'Please specify at least {min} answers!' => 'Per favor, especifica {min} respuestas como minimo!',
'Poll' => '',
'Polls' => 'Enqüestas',
'Question' => 'Pregunta',
'Reopen Poll' => 'Reubrir a enqüesta',
'Reset my vote' => '',
'Right now, we are in the planning stages for our next meetup and we would like to know from you, where you would like to go?' => '',
'Save' => 'Alzar',
'To Daniel' => '',
'User who vote this' => 'Usuarios que han votau isto',
'Users voted for: <strong>{answer}</strong>' => '',
'Vote' => 'Votar',
'Voting for multiple answers is disabled!' => '',
'Whenever someone participates in a poll.' => '',
'Why don\'t we go to Bemelmans Bar?' => '',
'You have insufficient permissions to perform that operation!' => '',
'and {count} more vote for this.' => 'y {count} mas han votau per isto.',
'votes' => 'votos',
'{n,plural,=1{# {htmlTagBegin}vote{htmlTagEnd}}other{# {htmlTagBegin}votes{htmlTagEnd}}}' => '',
'{userName} answered the {question}.' => '{userName} ha respondiu a {question}.',
'{userName} created a new poll and assigned you.' => '{userName} ha creyau una nueva enqüesta y te l\'ha asignau.',
'{userName} created a new {question}.' => '{userName} ha creyau la pregunta {question}.',
);
10 changes: 0 additions & 10 deletions messages/an/controllers_PollController.php

This file was deleted.

Loading
Loading