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

use a dl for achievement item list #2529

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

Alex-Jordan
Copy link
Contributor

This changes the list of earned achievement items to use a dl instead of a sequence of h3 tags.

Additionally, I believe this fixes some maketext issues where it was previously applied directly to a variable representing the name of an achievement item.

The badge section is also changed to indent at the same level as the item list.

And then some things from the achievements css are removed because they are no longer used.

Comment on lines 11 to 19
<h3><%= maketext($item->name)
. ' (' . maketext('[_1] remaining', $itemCounts->{ $item->id }) . ')' %></h3>
% $button_text = maketext('[_1] ([_2] remaining)', $item->name, $itemCounts->{ $item->id });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think $item->name isn't translated here, shouldn't this be to ensure translation on the name?

				% $button_text = maketext('[_1] ([_2] remaining)', maketext($item->name), $itemCounts->{ $item->id });

I thought name => x(string) only flags the string to be translated, but it won't be translated until it is run through maketext()? I think as a result you have also removed translation in a few places below as well (or am I not understanding how the x(....) creates translations).

This is at least in contrast to lines 11 and 14 where you do run the name and description through maketext.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do know there was some issue with nested maketext translations, but in this case I don't think it is an issue since we aren't translating a raw string, but the value of a variable that has been previously marked for translation?

@Alex-Jordan
Copy link
Contributor Author

Alex-Jordan commented Aug 18, 2024 via email

@drgrice1
Copy link
Sponsor Member

Yes, @somiaj is correct. The x method does not do any translation. It is just a marker so that the xgettext.pl script will add the string to the .pot file. Note that the .pot (and .po) files will only show the file and line number for the file where the x call is made, NOT where the translation is done. This is because the xgettext.pl only sees where the x call is made on the string, and doesn't see where the actual maketext call is done on the variable value that the result of the x call is stored in.

Also, the maketext call must be called only on what is put into the x method. So @somiaj's suggested change for line 19 is correct, and nesting the maketext will work in this case. Lines 21 and 23 will also need to be changed accordingly.

@drgrice1
Copy link
Sponsor Member

By the way, the dl restructuring generally looks good. However, I think that the font size of the reward item name is a bit large. You are using fs-3 for that. I would suggest using fs-4. The fs-3 font size is barely less than the font size used for the "Rewards" text in the h2 header for this section. Also, it is considerably larger than the fs-5 font size used for the badges below.

@Alex-Jordan
Copy link
Contributor Author

Thanks @somiaj, @drgrice1. I made those changes.

Copy link
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. I initially thought the number of items (4 remaining) looked odd inside the button, but I can't think of a better place to put that info.

@drgrice1 drgrice1 merged commit e746c04 into openwebwork:develop Aug 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants