Search code examples
twitter-bootstrapbootstrap-typeaheadbootstrap-tags-input

How to apply internationalization for Bootstrap Tags Input


I'm working with internationalization(jQuery i18n) for my project, And I've used Bootstrap Tags Input. I want to apply Localization for "Display Text" of The Tag.

Note: I've used "Objects as tags" in Bootstrap Tags Input. for more Ref: Bootstrap Tags Input


Solution

  • Its quite simple, In Bootstrap Tags Input itemText is available for displaying text of Tag. So we can do Localization when it returns an Item.

    We can Change in bootstrap-tagsinput.js at line Number 12.

    Change return this.itemValue(item); to
    return changeText('Label_'+this.itemValue(item),this.itemValue(item));

    changeText(key,Actual Text);
    

    The changeText is a function which returns Localization Text for that "Key", if Localization Text is not available then it returns "Actual Text" that we are displaying.