Changing strings in themes

4 views
Skip to first unread message

William Haynes

unread,
Mar 1, 2026, 11:57:56 AMMar 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 AMMar 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.

William Haynes

unread,
Mar 15, 2026, 12:42:28 PMMar 15
to Numbas Users
Thank you.  It works great.

Will

Reply all
Reply to author
Forward
0 new messages