簡體   English   中英

如何在select2中更改語言

[英]How to change language in select2

我在v4.0.3中使用select2

我想將默認語言從英語更改為西班牙語。 檢查國際化部分中的文檔,但是,如所示,它對我沒有用。

我關注您的評論anex代碼

 $("#multisearch").select2({ language: "es", closeOnSelect: false, placeholder: "Comienza tu búsqueda", data: [ { id: 0, text: 'Linea 1', children: [{ id: 1, text: 'San Pablo' }, { id: 2, text: 'Pajaritos' }, { id: 3, text: 'Las Rejas' }, { id: 4, text: 'Ecuador' }] }, { id: 5, text: 'Linea 2', children: [{ id: 6, text: 'La Cisterna' }, { id: 7, text: 'El Parrón' }, { id: 8, text: 'Lo Ovalle' }, { id: 9, text: 'Ciudad del niño' }, { id: 10, text: 'Pajaritos' } ] }, { id: 1, text: 'prueba' }, ]}); 
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script> <select multiple id="multisearch" style="width:500px"> </select> 

我會細心的,非常感謝

 $("#multisearch").select2({ language: "es", closeOnSelect: false, placeholder: "Comienza tu búsqueda", data: [ { id: 0, text: 'Linea 1', children: [{ id: 1, text: 'San Pablo' }, { id: 2, text: 'Pajaritos' }, { id: 3, text: 'Las Rejas' }, { id: 4, text: 'Ecuador' }] }, { id: 5, text: 'Linea 2', children: [{ id: 6, text: 'La Cisterna' }, { id: 7, text: 'El Parrón' }, { id: 8, text: 'Lo Ovalle' }, { id: 9, text: 'Ciudad del niño' }, { id: 10, text: 'Pajaritos' } ] }, { id: 1, text: 'prueba' }, ]}); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script> <select multiple id="multisearch" style="width:500px"> </select> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM