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

maketext - patch so it works inside PG also #3

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

taniwallach
Copy link
Member

Moving drdrew42#86 to here.


This continues work started in drdrew42#66.

maketext calls inside PG were not using the language requested by the API request, as lib/WeBWorK/lib/WeBWorK/PG.pm sets

	$envir{language}            = $ce->{language};

(the language later used for maketext calls inside PG) and the $seed_ce created by the Standalone renderer was not providing a language setting.

To fix the issue we add a language setting to the $seed_ce which will get passed into PG.

The change is done so that the core PG code pulled in from outside the Standalone repository does not need to be modified.

After this PR the maketext inside PG should hopefully work as well as they do in webwork2 and pg version 2.16. (The limitations of maketext in WWSafe probably still apply, so maketext calls inside PG cannot use a parameter at present.)


Testing can be done using via localhost when the renderer is running locally via Docker by checking the output of a page like http://localhost:3000/render-api?sourceFilePath=Library/Mizzou/Algebra/inverse_functions_and_relations/find_dom_range_inv_graph_01.pg&problemSeed=1&outputFormat=simple&language=heb before and after the patch.

Before the patch, you should see You can earn partial credit on this problem. in English just above the buttons (which will be in Hebrew) and after the patch (and a restart of the container) you should see ניתן לקבל ניקוד חלקי בשאלה זו. in Hebrew.

Before the patch:
BeforePatch

After the patch:
AfterPatch


At present, Hebrew is the only language other than English for which there is a PO translation dictionary for the renderer.

Use of any invalid value for language will cause maketext to fall back to the default (English) phrases.

the API request, as lib/WeBWorK/lib/WeBWorK/PG.pm sets
	$envir{language}            = $ce->{language};
and the $seed_ce was not providing the requested language.
To fix this we add a language setting to the $seed_ce.
@taniwallach taniwallach changed the base branch from main to develop July 22, 2022 14:38
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.

1 participant