Перейти к содержанию

Дайджесты за январь-февраль

Обновления гайдов и аддонов

Январь Февраль

Мониторинг серверов и редактор аддонов

Представляем вам две легенды. То, о чем можно было только мечтать, стало реальностью.

Мониторинг серверов Редактор аддонов

Подсказки из игры на вашем сайте

Теперь вы можете отображать сведения о внутриигровых элементах простым наведением курсора мыши.

Подробнее

Апдейтер аддонов

Представляем вам программу для автообновления аддонов и делимся подробностями.

Подробнее Скачать

Localizing a button


cristimirt

Рекомендуемые сообщения

Hi. How can I localize a button? I want to provide russian localization to one of my addons, and I managed to translate everything but the text of a button.

Ссылка на комментарий
Поделиться на другие сайты

You may use the .loc file way to do it. Simply put all text files into YourAddonsName.rus file(keeping the file paths), and they will be prioritized over the txt files in your original addon file, if the user has "rus" selected as his locale. I, however, did not try this.

I think that you may also use SetFormat or SetValue command to change the button's text. I, however, did not test this as well, and i think it has pretty high chances not to work with button widgets.

The .loc files distribution is not popular among addon developers, as it requires a separate file download for each addon/localization.

Ссылка на комментарий
Поделиться на другие сайты

SetFormat and SetValue won't work :( and the .loc files way would really be annoying. Is ther any way to set the value of a button from the script files?

Ссылка на комментарий
Поделиться на другие сайты

WidgetButton.xdb


<Variants>
<Item>
<TextFileRef href="Text-alignx-center" />
 <FormatFileRef  href="ButtonExecute.txt" />
<Reaction>execute</Reaction>
</Item>
</Variants>

ButtonExecute.txt

<button><tip_grey><r name="button_label"/></tip_grey></button>

Lua

wtButton1:SetVal("button_label", userMods.ToWString("-") )

Ссылка на комментарий
Поделиться на другие сайты

Still not getting it. I'm a noob. I'll try to find an addon that has a localized button and see if I can learn from it :) Thanks for the help though. Much appreciated.

Изменено пользователем cristimirt
Ссылка на комментарий
Поделиться на другие сайты

I made it to work.. somehow.

This is the WidgetButton.xdb

<Variants>
<Item>
<TextFileRef href="ButtonClose.txt" />
<Reaction>close</Reaction>
</Item>
</Variants>

This is the ButtonClose.txt

<button fontsize="11"><r name="button_label"/></button>

And this is the LUA code:

wtCloseBtn:SetVal("button_label", toWS(GetTextLocalized("Close")))

I don't know why it didn't work previously, but I'm glad it works now. I looked at how GuilGui1b does things :)

Изменено пользователем cristimirt
Ссылка на комментарий
Поделиться на другие сайты

Still not getting it. I'm a noob. I'll try to find an addon that has a localized button and see if I can learn from it :) Thanks for the help though. Much appreciated.

AddonManager. GuildGui1b. Enough?

Ссылка на комментарий
Поделиться на другие сайты

AddonManager. GuildGui1b. Enough?

Yeah, I checked GuildGui1b. I don't have AddonManager anymore, I'm using AddonReloader for reloading addons :P

Ссылка на комментарий
Поделиться на другие сайты

Гость
Ответить в этой теме...

×   Вставлено с форматированием.   Восстановить форматирование

  Разрешено использовать не более 75 эмодзи.

×   Ваша ссылка была автоматически встроена.   Отображать как обычную ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставлять изображения напрямую. Загружайте или вставляйте изображения по ссылке.

×
×
  • Создать...

Важная информация

Пользуясь сайтом, вы принимаете Условия использования