Sha256: f0f26493bd9d743d07772c54b81ab4f84098671c1972e9a1c46bfad57e8afb95

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

var I18n = require("../../lib/i18n")
  , Translations = require("./translations")
;

describe("Localization", function(){
  var actual, expected;

  beforeEach(function() {
    I18n.reset();
    I18n.translations = Translations();
  });

  it("localizes number", function(){
    expect(I18n.l("number", 1234567)).toEqual("1,234,567.000");
  });

  it("localizes currency", function(){
    expect(I18n.l("currency", 1234567)).toEqual("$1,234,567.00");
  });

  it("localizes date strings", function(){
    I18n.locale = "pt-BR";

    expect(I18n.l("date.formats.default", "2009-11-29")).toEqual("29/11/2009");
    expect(I18n.l("date.formats.short", "2009-01-07")).toEqual("07 de Janeiro");
    expect(I18n.l("date.formats.long", "2009-01-07")).toEqual("07 de Janeiro de 2009");
  });

  it("localizes time strings", function(){
    I18n.locale = "pt-BR";

    expect(I18n.l("time.formats.default", "2009-11-29 15:07:59")).toEqual("Domingo, 29 de Novembro de 2009, 15:07 h");
    expect(I18n.l("time.formats.short", "2009-01-07 09:12:35")).toEqual("07/01, 09:12 h");
    expect(I18n.l("time.formats.long", "2009-11-29 15:07:59")).toEqual("Domingo, 29 de Novembro de 2009, 15:07 h");
  });

  it("localizes percentage", function(){
    I18n.locale = "pt-BR";
    expect(I18n.l("percentage", 123.45)).toEqual("123,45%");
  });
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i18n-js-3.0.0.rc1 spec/js/localization.spec.js