سؤال

i have use the following string as value of the button

"Drag a column header here to group its column" with culture as en-US

how to change this string based on the different language settings/ culture .Is there any other way to achieve this by using Globalize.format to convert

لا يوجد حل صحيح

نصائح أخرى

You could set the localized instructions in an object like so:

var instructions = {
  "en" : "Drag a column header here to group its column",
  "fr" : "Faites glisser un en-tête de colonne ici pour groupe sa colonne",
  "cn" : "这里将一个列标题,集团将其列"
}

And assuming your button has an id of "#example_button", you could have a jQuery function like this :

function set_button_instruction_value(text) {
  $("#example_button").prop('value', text);
}

So if you saved your localization to a variable, such as "locale":

var locale = "en";

You can call this to change the value of the button:

set_button_instruction_value(instructions[locale]);

I don't think Globalize.format can directly determine how to set the button text unless you wanted to set a locale based on the way a date is displayed.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top