Changing strings in themes

1 view
Skip to first unread message

William Haynes

unread,
Mar 1, 2026, 11:57:56 AM (12 days ago) Mar 1
to Numbas Users
When writing a theme, what's the recommended way to change a few of the localization strings?

Thanks,
Will

Christian Lawson-Perfect

unread,
Mar 12, 2026, 10:56:43 AM (20 hours ago) Mar 12
to numbas...@googlegroups.com
There isn't a recommended way. I've wanted to come up with one for a long time - see the issue https://github.com/numbas/Numbas/issues/493 from 2017.

One way to do it is to just add a script file that changes keys in the localisation resources. Here's an example:

Numbas.queueScript('change-strings', ['localisation'], function() {
  Object.assign(Numbas.locale.resources['en-gb'].translation, {
    'frontpage.start': 'haway',
  });
});

Save that in your theme as files/scripts/change-strings.js.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/numbas-users/082afa60-03e8-4ce2-b5c6-1c31d8217d48n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages