Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

i18n #16

Open
Open

Description

@marcioaguiar

Suport for multiple languages.

Text to create new item is hardcoded english.

Activity

  1. brianreavis commented on Jun 5, 2013

    @brianreavis
    Member

    I think this would be an easy thing to address... might as well. In the meantime, you can always provide a render.option_create function in the settings to custom-render that dropdown item.

  2. nurikabe commented on May 23, 2014

    @nurikabe

    +1

  3. raulromanp commented on Oct 16, 2014

    @raulromanp

    +1

  4. danielfariati commented on Nov 20, 2014

    @danielfariati

    +1

  5. deepugn commented on Dec 17, 2014

    @deepugn

    +1

  6. iainvdw commented on Aug 3, 2015

    @iainvdw

    +1

  7. klzns commented on Sep 2, 2015

    @klzns

    If anyone is wondering how to change it as @brianreavis suggested, just do something like this:

    $('.my-select').selectize({
      create: true,
      render: {
        option_create: function(data, escape) {
          var addString = 'Adicionar';
          return '<div class="create">' + addString + ' <strong>' + escape(data.input) + '</strong>&hellip;</div>';
        }
      }
    });
  8. joallard commented on Jan 3, 2016

    @joallard
    Member

    As someone who's native tongue is French, I'd be inclined to accept a PR making this simpler. We could add an option allowing you to spectify a string (eg. addString: "Add %{name}") or a function addString: function(word){ I18n.t("selectize.add", word)}.

  9. added a commit that references this issue on Jan 11, 2016
  10. Oxicode commented on May 4, 2016

    @Oxicode

    +1

  11. joallard commented on May 4, 2016

    @joallard
    Member

    I'll go even further in this, the function would be called with two params, function(word, key), allowing one to do:

    addString: I18n.t

    instead of:

    addString: function(word, key){ I18n.t(word, key) }

    Default: I18n.t if exists (or whatever is the JS convention for translation), or "Add %{name}".

    or something automagic like that.

  12. joallard commented on May 9, 2016

    @joallard
    Member
    • Figure out strings that can be translated
    • Figure out I18n conventions in JS and sensible defaults
    • Begin writing tests
    • Finish writing tests
    • Write the code
  13. joallard commented on May 9, 2016

    @joallard
    Member

    Here's what I see:

    describe("I18n", function(){
        describe("dictionary syntax", function(){
            var s = Selectize.init({
                dictionary: {
                    addThis: "Ajouter %{elem}"
                }
            })
    
            expect(s.i18n('addThis', {elem: 'ceci'}).to.equal("Ajouter ceci")
        })
    
        describe("delegate to i18n library", function(){
            var I18n = {
                t: function(key, params) {
                    return "Ajouter " + params.elem;
                }
            }
    
            var s = Selectize.init({
                i18n: I18n.t
            });
    
            expect(s.i18n('addThis', {elem: 'ceci'})).to.equal("Ajouter ceci")
        })
    
        describe("default i18n library", function(){
            var I18n = {
                t: function(key, params) {
                    return "Ajouter " + params.elem;
                }
            }
    
            var s = Selectize.init({
                // i18n: default
            });
    
            expect(s.i18n('addThis', {elem: 'ceci'})).to.equal("Ajouter ceci")
        })
    })
  14. added this to the 0.13.0 milestone on May 9, 2016
  15. joallard commented on Jul 20, 2016

    @joallard
    Member

    Libraries i18next, I18n-js and Polyglot all use syntax .t()

  16. risadams commented on Nov 12, 2020

    @risadams
    Contributor

    closing stale issues older than one year.
    If this issue was closed in error please message the maintainers.
    All issues must include a proper title, description, and examples.

  17. pixelbart commented on Jun 20, 2022

    @pixelbart

    Is it possible to translate things meanwhile?

    For example, remove-single has "remove" in the title. This would have to be translated for my use case.

    image

  18. joallard commented on Jun 25, 2022

    @joallard
    Member

    It's been a while I haven't touched this project, but I would imagine a PR that makes it possible to specify the language string in the options would be a great start.

    – Oops, actually that's what #902 proposed and I closed the PR in favor of this one. (harsh.) Funny how I don't agree with my past self anymore, I think something along the lines of #902 is a good idea, maybe a bit more fleshed out. But again, I'm not the one who puts much work in this project anymore so that's only my own personal opinion!

  19. risadams commented on Jun 30, 2022

    @risadams
    Contributor

    always welcome a PR, my time is stretched these days too, and I fully admit that my i18n skills are underdeveloped. I agree that #902 at least feels more simple to implement, but I would need to do some research before jumping in myself

  20. added
    pending reviewThis issue was closed as stale; since then additional review has been requested.
    on Jun 30, 2022
  21. gotivac commented on Oct 26, 2024

    @gotivac

    Huh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions