ElggLanguagesTest.js 700 B

12345678910111213141516171819202122232425262728293031323334
  1. define(function(require) {
  2. var elgg = require('elgg');
  3. describe("elgg.i18n", function() {
  4. afterEach(function() {
  5. elgg.config.translations = {};
  6. });
  7. describe("elgg.echo", function() {
  8. it("translates the given string", function() {
  9. elgg.add_translation('en', {
  10. 'hello': 'Hello!'
  11. });
  12. elgg.add_translation('es', {
  13. 'hello': 'Hola!'
  14. });
  15. expect(elgg.echo('hello')).toBe('Hello!');
  16. expect(elgg.echo('hello', 'es')).toBe('Hola!');
  17. });
  18. it("falls back to the default language", function() {
  19. elgg.add_translation('en', {
  20. 'hello': 'Hello!'
  21. });
  22. expect(elgg.echo('hello', 'es')).toBe('Hello!');
  23. });
  24. });
  25. });
  26. });