mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
* Re-organize common folder * fix: Correct paths in tests * fix: move new content to proper folder * chore: Move audio folder to assets * Move sprites to sprites assets directory * Move css sprites to assets directory * Split out readmes for common code and sprites * Move images to assets directory * Move destinatin of shared browserified file * remove unused file * move compiled js to client-old * Fix karma tests * fix: Correct paths for sprites
19 lines
773 B
JavaScript
19 lines
773 B
JavaScript
import i18n from '../../../website/common/script/i18n';
|
|
i18n.translations = require('../../../website/server/libs/i18n').translations;
|
|
|
|
// Use this to verify error messages returned by the server
|
|
// That way, if the translated string changes, the test
|
|
// will not break. NOTE: it checks against errors with string as well.
|
|
export function translate (key, variables) {
|
|
const STRING_ERROR_MSG = 'Error processing the string. Please see Help > Report a Bug.';
|
|
const STRING_DOES_NOT_EXIST_MSG = /^String '.*' not found.$/;
|
|
|
|
let translatedString = i18n.t(key, variables);
|
|
|
|
expect(translatedString).to.not.be.empty;
|
|
expect(translatedString).to.not.eql(STRING_ERROR_MSG);
|
|
expect(translatedString).to.not.match(STRING_DOES_NOT_EXIST_MSG);
|
|
|
|
return translatedString;
|
|
}
|