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

Fix for issue 1477 - uses a revised method of getting "tab titles" in Classlist editor / Homework set editor /Achiev ement editor into the translation files #1487

Merged
merged 2 commits into from
Aug 24, 2021
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use warnings;
#use CGI qw(-nosticky );
use WeBWorK::CGI;
use WeBWorK::Debug;
use WeBWorK::Utils qw(timeToSec readFile listFilesRecursive sortAchievements);
use WeBWorK::Utils qw(timeToSec readFile listFilesRecursive sortAchievements x);
use DateTime;
use Text::CSV;
use Encode;
Expand All @@ -65,6 +65,21 @@ use constant EDIT_FORMS => [qw(saveEdit cancelEdit)];
use constant VIEW_FORMS => [qw(edit assign import export score create delete)];
use constant EXPORT_FORMS => [qw(saveExport cancelExport)];

# Prepare the tab titles for translation by maketext
use constant FORM_TITLES => {
saveEdit => x("Save Edit"),
cancelEdit => x("Cancel Edit"),
edit => x("Edit"),
assign => x("Assign"),
import => x("Import"),
export => x("Export"),
score => x("Score"),
create => x("Create"),
delete => x("Delete"),
saveExport => x("Save Export"),
cancelExport => x("Cancel Export")
};

use constant VIEW_FIELD_ORDER => [ qw( enabled achievement_id name number category ) ];
use constant EDIT_FIELD_ORDER => [ qw( icon achievement_id name number assignment_type category enabled points max_counter description icon_file test_file) ];
use constant EXPORT_FIELD_ORDER => [ qw( select achievement_id name) ];
Expand Down Expand Up @@ -294,6 +309,7 @@ sub body {
} else {
@formsToShow = @{ VIEW_FORMS() };
}
my %formTitles = %{ FORM_TITLES() };

my @tabArr;
my @contentArr;
Expand All @@ -304,7 +320,7 @@ sub body {

push(@tabArr, CGI::li($actionID eq $formsToShow[0] ? { class => "active" } : {},
CGI::a({ href => "#$id", data_toggle => "tab", class => "action-link", data_action => $actionID },
$r->maketext(ucfirst(WeBWorK::split_cap($actionID))))));
$r->maketext($formTitles{$actionID}))));
push(@contentArr, CGI::div({
class => "tab-pane achievement_list_action_div" . ($actionID eq $formsToShow[0] ? " active" : ""),
id => $id
Expand Down
24 changes: 18 additions & 6 deletions lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,22 @@ use constant EDIT_FORMS => [qw(saveEdit cancelEdit)];
use constant VIEW_FORMS => [qw(filter sort edit publish import export score create delete)];
use constant EXPORT_FORMS => [qw(saveExport cancelExport)];

# capture names for maketext
# (gettext only takes the last one if the use constant is not here)
use constant mk_filter => x('Filter');
use constant mk_sort => x('Sort');
use constant mk_publish => x('Publish');
# Prepare the tab titles for translation by maketext
use constant FORM_TITLES => {
saveEdit => x("Save Edit"),
cancelEdit => x("Cancel Edit"),
filter => x("Filter"),
sort => x("Sort"),
edit => x("Edit"),
publish => x("Publish"),
import => x("Import"),
export => x("Export"),
score => x("Score"),
create => x("Create"),
delete => x("Delete"),
saveExport => x("Save Export"),
cancelExport => x("Cancel Export")
};

use constant VIEW_FIELD_ORDER => [ qw( set_id problems users visible enable_reduced_scoring open_date reduced_scoring_date due_date answer_date) ];
use constant EDIT_FIELD_ORDER => [ qw( set_id visible enable_reduced_scoring open_date reduced_scoring_date due_date answer_date) ];
Expand Down Expand Up @@ -575,6 +586,7 @@ sub body {
} else {
@formsToShow = @{ VIEW_FORMS() };
}
my %formTitles = %{ FORM_TITLES() };

my @tabArr;
my @contentArr;
Expand All @@ -592,7 +604,7 @@ sub body {

push(@tabArr, CGI::li({ class => $active },
CGI::a({ href => "#$id", data_toggle => "tab", class => "action-link", data_action => $actionID },
$r->maketext(ucfirst(WeBWorK::split_cap($actionID))))));
$r->maketext($formTitles{$actionID}))));
push(@contentArr, CGI::div({ class => "tab-pane $active", id => $id },
$self->$actionForm($self->getActionParams($actionID))));
}
Expand Down
22 changes: 17 additions & 5 deletions lib/WeBWorK/ContentGenerator/Instructor/UserList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,21 @@ use constant EDIT_FORMS => [qw(saveEdit cancelEdit)];
use constant PASSWORD_FORMS => [qw(savePassword cancelPassword)];
use constant VIEW_FORMS => [qw(filter sort edit password import export add delete)];

# capture names for maketext
# (gettext only takes the last one if the use constant is not here)
use constant mk_filter => x('Filter');
use constant mk_sort => x('Sort');
# Prepare the tab titles for translation by maketext
use constant FORM_TITLES => {
saveEdit => x("Save Edit"),
cancelEdit => x("Cancel Edit"),
filter => x("Filter"),
sort => x("Sort"),
edit => x("Edit"),
password => x("Password"),
import => x("Import"),
export => x("Export"),
add => x("Add"),
delete => x("Delete"),
savePassword => x("Save Password"),
cancelPassword => x("Cancel Password")
};

# permissions needed to perform a given action
use constant FORM_PERMS => {
Expand Down Expand Up @@ -519,6 +530,7 @@ sub body {
} else {
@formsToShow = @{ VIEW_FORMS() };
}
my %formTitles = %{ FORM_TITLES() };

my @tabArr;
my @contentArr;
Expand All @@ -536,7 +548,7 @@ sub body {

push(@tabArr, CGI::li({ class => $active },
CGI::a({ href => "#$id", data_toggle => "tab", class => "action-link", data_action => $actionID },
$r->maketext(ucfirst(WeBWorK::split_cap($actionID))))));
$r->maketext($formTitles{$actionID}))));
push(@contentArr, CGI::div({ class => "tab-pane $active", id => $id },
$self->$actionForm($self->getActionParams($actionID))));
}
Expand Down
Loading