URTrator now can be translated.

This commit is contained in:
Stanislav Nikitin 2017-02-09 01:16:51 +05:00
parent 9821eb28fd
commit 65f6bd8b4d
20 changed files with 1070 additions and 248 deletions

View File

@ -96,6 +96,11 @@ go install github.com/pztrn/urtrator
# Important information
## Translation
Feel free to ping me everywhere you can and ask for adding a language
for translation, if not already added [here](https://www.transifex.com/issuewarrior/urtrator/dashboard/).
## GTK warnings in console
Many GTK warnings in console may appear while using URTrator. Unfortunately,

View File

@ -24,6 +24,7 @@ import (
"github.com/pztrn/urtrator/launcher"
"github.com/pztrn/urtrator/requester"
"github.com/pztrn/urtrator/timer"
"github.com/pztrn/urtrator/translator"
// Github
"github.com/mattn/go-gtk/gtk"
@ -48,6 +49,8 @@ type Context struct {
Requester *requester.Requester
// Timer.
Timer *timer.Timer
// Translator.
Translator *translator.Translator
}
func (ctx *Context) Close() error {
@ -112,8 +115,14 @@ func (ctx *Context) initializeTimer() {
ctx.Timer.Initialize()
}
func (ctx *Context) initializeTranslator() {
ctx.Translator = translator.New()
ctx.Translator.Initialize()
}
func (ctx *Context) Initialize() {
fmt.Println("Initializing application context...")
ctx.initializeTranslator()
ctx.initializeColorizer()
ctx.initializeConfig()
ctx.initializeDatabase()

View File

@ -0,0 +1,148 @@
{
"Delete selected profile. Do nothing if no profile was selected.": "",
"Copy server's creds": "",
"Invalid game profile selected.": "",
"Invalid game profile specified in favorite entry.": "",
"Nickname:": "",
"File": "",
"Invalid game profile selected.\\n\\nPlease, select profile and retry.": "",
"Master server address": "",
"User declined to connect to offline server": "",
"Value": "",
"Server's name": "",
"Appearance": "",
"Additional parameters that will be passed to Urban Terror executable.": "",
"Add new profile": "",
"Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\\n\\nQuake3-UrT.i386 for linux-x86\\nQuake3-UrT.x86_64 for linux-amd64\\nQuake3-UrT.app for macOS": "",
"Invalid path to binary!\\n\\nError was:\\n": "",
"Automatically update URTrator?": "",
"OK": "",
"URTrator is ready.": "",
"Close without saving": "",
"Server isn't favorited": "",
"Urban Terror version for which this profile applies.": "",
"Show CVars": "",
"Delete": "",
"URTrator - Server CVars": "",
"Hide private servers": "",
"Profile:": "",
"Update selected server": "",
"Urban Terror version:": "",
"Cannot delete server from favorites.\\n\\nServer isn't favorited.": "",
"Updating selected server...": "",
"Profile wasn't selected.\\n\\nPlease, select valid profile for this server.\\nIf you haven't add profiles yet - you can do it\\nin options on \\\"Urban Terror\\\" tab.": "",
"Show / Hide URTrator": "",
"_Options": "",
"Status": "",
"Remove from favorites": "",
"Servers": "",
"Cancel": "",
"Show only servers which uses selected version of Urban Terror": "",
"User didn't select valid profile, mismatch with server's version.": "",
"Remove selected server from favorites": "",
"Exit": "",
"Edit selected profile. Do nothing if no profile was selected.": "",
"Current map": "",
"Urban Terror": "",
"Edit": "",
"Urban Terror is launched with profile": "",
"Browse": "",
"Launch!": "",
"Password we will use for server": "",
"Show server's CVars": "",
"Hide offline servers": "",
"Profile name:": "",
"Mode": "",
"Timeout which will trigger servers information update, in minutes.": "",
"Profile name": "",
"No server selected.\\n\\nPlease, select a server to continue connecting.": "",
"Invalid game profile specified for favorite server.\\n\\nPlease, edit your favorite server, select valid profile and retry.": "",
"No": "",
"Close": "",
"Hide offline servers on Favorites tab": "",
"Hide servers which requires password to enter": "",
"URTrator - {{ action }} favorite server": "",
"Servers updated.": "",
"Add to favorites": "",
"_?": "",
"No server selected.": "",
"Public": "",
"Additional parameters:": "",
"Update": "",
"Empty path to binary!\\nThis profile will be unusable if you\\nwill not provide path to binary!": "",
"Update profile": "",
"Quick connect": "",
"Urban Terror binary:": "",
"Servers update timeout (minutes)": "",
"E_xit": "",
"Start Urban Terror in another X session?": "",
"User didn't select valid profile.": "",
"Name": "",
"Add profile": "",
"Server address is empty.\\n\\nServers without address cannot be added.": "",
"Profile which will be used for launching": "",
"Server address we will connect to": "",
"Invalid game profile selected.\\n\\nSelected profile have different game version than server.\\nPlease, select valid profile and retry.": "",
"Password:": "",
"Selected server is offline.\\n\\nWould you still want to launch Urban Terror?\\nIt will just launch a game, without connecting to\\nany server.": "",
"Empty profile name!\\nProfile must be named somehow.": "",
"Update server information": "",
"Passworded": "",
"URTrator - Update Urban Terror profile": "",
"Server address:": "",
"Update all servers in currently selected tab": "",
"Show only servers which uses selected game mode": "",
"Update only selected server": "",
"URTrator - Options": "",
"Hide offline servers on Servers tab": "",
"Urban Terror servers browser and game launcher": "",
"Version": "",
"URTrator is ready": "",
"Server information": "",
"Map": "",
"Ping": "",
"Updating servers...": "",
"Drop database data...": "",
"Frags": "",
"IP": "",
"Launch Urban Terror": "",
"Game profile:": "",
"Select a server we will connect to!": "",
"Remove ~/.config/urtrator/database.sqlite3 manually!": "",
"Update all servers": "",
"Game mode": "",
"There will be some appearance configuration options soon.": "",
"Add": "",
"Should servers be automatically updated?": "",
"Game profile with same name already exist.\\nRename profile for saving.": "",
"URTrator - Select Urban Terror binary": "",
"Key": "",
"Players": "",
"Player name": "",
"This how you will see profile on profiles lists.": "",
"Add selected server to favorites": "",
"Edit selected favorite server": "",
"Server name:": "",
"Edit favorite": "",
"All versions": "",
"Favorites": "",
"If this is checked, Urban Terror will be launched in another X session.\\n\\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin.": "",
"Address of master server. Specify in form: addr:port.": "",
"About _URTrator...": "",
"All available profiles": "",
"General": "",
"URTrator - Add Urban Terror profile": "",
"Copy server's credentials to clipboard for sharing": "",
"You are about to drop whole database data.\\n\\nAfter clicking \\\"YES\\\" ALL data in database (servers, profiles, settings, etc.)\\nwill be lost FOREVER. Are you sure?": "",
"Urban Terror version": "",
"Some options require application restart to be applied.": "",
"Invalid binary selected!\\nAccording to your OS, it should be": "",
"Show icon in tray": "",
"All gamemodes": "",
"Nickname we will use": "",
"Yes": "",
"Should URTrator check for updates and update itself? Not working now.": "",
"Game version": "",
"Servers updating": "",
"Servers autoupdate": ""
}

View File

@ -0,0 +1,148 @@
{
"Delete selected profile. Do nothing if no profile was selected.": "Delete selected profile. Do nothing if no profile was selected.",
"Copy server's creds": "Copy server's creds",
"Invalid game profile selected.": "Invalid game profile selected.",
"Invalid game profile specified in favorite entry.": "Invalid game profile specified in favorite entry.",
"Nickname:": "Nickname:",
"File": "File",
"Invalid game profile selected.\\n\\nPlease, select profile and retry.": "Invalid game profile selected.\\n\\nPlease, select profile and retry.",
"Master server address": "Master server address",
"User declined to connect to offline server": "User declined to connect to offline server",
"Value": "Value",
"Server's name": "Server's name",
"Appearance": "Appearance",
"Additional parameters that will be passed to Urban Terror executable.": "Additional parameters that will be passed to Urban Terror executable.",
"Add new profile": "Add new profile",
"Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\\n\\nQuake3-UrT.i386 for linux-x86\\nQuake3-UrT.x86_64 for linux-amd64\\nQuake3-UrT.app for macOS": "Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\\n\\nQuake3-UrT.i386 for linux-x86\\nQuake3-UrT.x86_64 for linux-amd64\\nQuake3-UrT.app for macOS",
"Invalid path to binary!\\n\\nError was:\\n": "Invalid path to binary!\\n\\nError was:\\n",
"Automatically update URTrator?": "Automatically update URTrator?",
"OK": "OK",
"URTrator is ready.": "URTrator is ready.",
"Close without saving": "Close without saving",
"Server isn't favorited": "Server isn't favorited",
"Urban Terror version for which this profile applies.": "Urban Terror version for which this profile applies.",
"Show CVars": "Show CVars",
"Delete": "Delete",
"URTrator - Server CVars": "URTrator - Server CVars",
"Hide private servers": "Hide private servers",
"Profile:": "Profile:",
"Update selected server": "Update selected server",
"Urban Terror version:": "Urban Terror version:",
"Cannot delete server from favorites.\\n\\nServer isn't favorited.": "Cannot delete server from favorites.\\n\\nServer isn't favorited.",
"Updating selected server...": "Updating selected server...",
"Profile wasn't selected.\\n\\nPlease, select valid profile for this server.\\nIf you haven't add profiles yet - you can do it\\nin options on \\\"Urban Terror\\\" tab.": "Profile wasn't selected.\\n\\nPlease, select valid profile for this server.\\nIf you haven't add profiles yet - you can do it\\nin options on \\\"Urban Terror\\\" tab.",
"Show / Hide URTrator": "Show / Hide URTrator",
"_Options": "_Options",
"Status": "Status",
"Remove from favorites": "Remove from favorites",
"Servers": "Servers",
"Cancel": "Cancel",
"Show only servers which uses selected version of Urban Terror": "Show only servers which uses selected version of Urban Terror",
"User didn't select valid profile, mismatch with server's version.": "User didn't select valid profile, mismatch with server's version.",
"Remove selected server from favorites": "Remove selected server from favorites",
"Exit": "Exit",
"Edit selected profile. Do nothing if no profile was selected.": "Edit selected profile. Do nothing if no profile was selected.",
"Current map": "Current map",
"Urban Terror": "Urban Terror",
"Edit": "Edit",
"Urban Terror is launched with profile": "Urban Terror is launched with profile",
"Browse": "Browse",
"Launch!": "Launch!",
"Password we will use for server": "Password we will use for server",
"Show server's CVars": "Show server's CVars",
"Hide offline servers": "Hide offline servers",
"Profile name:": "Profile name:",
"Mode": "Mode",
"Timeout which will trigger servers information update, in minutes.": "Timeout which will trigger servers information update, in minutes.",
"Profile name": "Profile name",
"No server selected.\\n\\nPlease, select a server to continue connecting.": "No server selected.\\n\\nPlease, select a server to continue connecting.",
"Invalid game profile specified for favorite server.\\n\\nPlease, edit your favorite server, select valid profile and retry.": "Invalid game profile specified for favorite server.\\n\\nPlease, edit your favorite server, select valid profile and retry.",
"No": "No",
"Close": "Close",
"Hide offline servers on Favorites tab": "Hide offline servers on Favorites tab",
"Hide servers which requires password to enter": "Hide servers which requires password to enter",
"URTrator - {{ action }} favorite server": "URTrator - {{ action }} favorite server",
"Servers updated.": "Servers updated.",
"Add to favorites": "Add to favorites",
"_?": "_?",
"No server selected.": "No server selected.",
"Public": "Public",
"Additional parameters:": "Additional parameters:",
"Update": "Update",
"Empty path to binary!\\nThis profile will be unusable if you\\nwill not provide path to binary!": "Empty path to binary!\\nThis profile will be unusable if you\\nwill not provide path to binary!",
"Update profile": "Update profile",
"Quick connect": "Quick connect",
"Urban Terror binary:": "Urban Terror binary:",
"Servers update timeout (minutes)": "Servers update timeout (minutes)",
"E_xit": "E_xit",
"Start Urban Terror in another X session?": "Start Urban Terror in another X session?",
"User didn't select valid profile.": "User didn't select valid profile.",
"Name": "Name",
"Add profile": "Add profile",
"Server address is empty.\\n\\nServers without address cannot be added.": "Server address is empty.\\n\\nServers without address cannot be added.",
"Profile which will be used for launching": "Profile which will be used for launching",
"Server address we will connect to": "Server address we will connect to",
"Invalid game profile selected.\\n\\nSelected profile have different game version than server.\\nPlease, select valid profile and retry.": "Invalid game profile selected.\\n\\nSelected profile have different game version than server.\\nPlease, select valid profile and retry.",
"Password:": "Password:",
"Selected server is offline.\\n\\nWould you still want to launch Urban Terror?\\nIt will just launch a game, without connecting to\\nany server.": "Selected server is offline.\\n\\nWould you still want to launch Urban Terror?\\nIt will just launch a game, without connecting to\\nany server.",
"Empty profile name!\\nProfile must be named somehow.": "Empty profile name!\\nProfile must be named somehow.",
"Update server information": "Update server information",
"Passworded": "Passworded",
"URTrator - Update Urban Terror profile": "URTrator - Update Urban Terror profile",
"Server address:": "Server address:",
"Update all servers in currently selected tab": "Update all servers in currently selected tab",
"Show only servers which uses selected game mode": "Show only servers which uses selected game mode",
"Update only selected server": "Update only selected server",
"URTrator - Options": "URTrator - Options",
"Hide offline servers on Servers tab": "Hide offline servers on Servers tab",
"Urban Terror servers browser and game launcher": "Urban Terror servers browser and game launcher",
"Version": "Version",
"URTrator is ready": "URTrator is ready",
"Server information": "Server information",
"Map": "Map",
"Ping": "Ping",
"Updating servers...": "Updating servers...",
"Drop database data...": "Drop database data...",
"Frags": "Frags",
"IP": "IP",
"Launch Urban Terror": "Launch Urban Terror",
"Game profile:": "Game profile:",
"Select a server we will connect to!": "Select a server we will connect to!",
"Remove ~/.config/urtrator/database.sqlite3 manually!": "Remove ~/.config/urtrator/database.sqlite3 manually!",
"Update all servers": "Update all servers",
"Game mode": "Game mode",
"There will be some appearance configuration options soon.": "There will be some appearance configuration options soon.",
"Add": "Add",
"Should servers be automatically updated?": "Should servers be automatically updated?",
"Game profile with same name already exist.\\nRename profile for saving.": "Game profile with same name already exist.\\nRename profile for saving.",
"URTrator - Select Urban Terror binary": "URTrator - Select Urban Terror binary",
"Key": "Key",
"Players": "Players",
"Player name": "Player name",
"This how you will see profile on profiles lists.": "This how you will see profile on profiles lists.",
"Add selected server to favorites": "Add selected server to favorites",
"Edit selected favorite server": "Edit selected favorite server",
"Server name:": "Server name:",
"Edit favorite": "Edit favorite",
"All versions": "All versions",
"Favorites": "Favorites",
"If this is checked, Urban Terror will be launched in another X session.\\n\\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin.": "If this is checked, Urban Terror will be launched in another X session.\\n\\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin.",
"Address of master server. Specify in form: addr:port.": "Address of master server. Specify in form: addr:port.",
"About _URTrator...": "About _URTrator...",
"All available profiles": "All available profiles",
"General": "General",
"URTrator - Add Urban Terror profile": "URTrator - Add Urban Terror profile",
"Copy server's credentials to clipboard for sharing": "Copy server's credentials to clipboard for sharing",
"You are about to drop whole database data.\\n\\nAfter clicking \\\"YES\\\" ALL data in database (servers, profiles, settings, etc.)\\nwill be lost FOREVER. Are you sure?": "You are about to drop whole database data.\\n\\nAfter clicking \\\"YES\\\" ALL data in database (servers, profiles, settings, etc.)\\nwill be lost FOREVER. Are you sure?",
"Urban Terror version": "Urban Terror version",
"Some options require application restart to be applied.": "Some options require application restart to be applied.",
"Invalid binary selected!\\nAccording to your OS, it should be": "Invalid binary selected!\\nAccording to your OS, it should be",
"Show icon in tray": "Show icon in tray",
"All gamemodes": "All gamemodes",
"Nickname we will use": "Nickname we will use",
"Yes": "Yes",
"Should URTrator check for updates and update itself? Not working now.": "Should URTrator check for updates and update itself? Not working now.",
"Game version": "Game version",
"Servers updating": "Servers updating",
"Servers autoupdate": "Servers autoupdate"
}

View File

@ -0,0 +1,148 @@
{
"Delete selected profile. Do nothing if no profile was selected.": "Удаление выбранного профиля. Не делает ничего если никакой профиль не выбран.",
"Copy server's creds": "Скопировать данные сервера",
"Invalid game profile selected.": "Выбран неправильный профиль игры.",
"Invalid game profile specified in favorite entry.": "Неправильный профиль игры указан в избранном сервере.",
"Nickname:": "Ник:",
"File": "Файл",
"Invalid game profile selected.\\n\\nPlease, select profile and retry.": "Выбран неправильный игровой профиль.\n\nПожалуйста, выберите правильный профиль и попробуйте еще раз.",
"Master server address": "Адрес мастер-сервера",
"User declined to connect to offline server": "Пользователь отказался от подключения к отключенному серверу",
"Value": "Значение",
"Server's name": "Название сервера",
"Appearance": "Внешний вид",
"Additional parameters that will be passed to Urban Terror executable.": "Дополнительные параметры, которые будут переданы исполняемому файлу Urban Terror",
"Add new profile": "Добавить новый профиль",
"Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\\n\\nQuake3-UrT.i386 for linux-x86\\nQuake3-UrT.x86_64 for linux-amd64\\nQuake3-UrT.app for macOS": "Исполняемый файл Urban Terror. Будут выполнены проверки, поэтому убедитесь, что вы выбрали прафильный файл:\n\nQuake3-UrT.i386 для linux-x86\nQuake3-UrT.x86_64 для linux-amd64\nQuake3-UrT.app для macOS",
"Invalid path to binary!\\n\\nError was:\\n": "Неправильный путь до исполняемого файла!\n\nОшибка была:",
"Automatically update URTrator?": "Обновлять URTrator автоматически?",
"OK": "ОК",
"URTrator is ready.": "URTrator готов.",
"Close without saving": "Закрыть без сохранения",
"Server isn't favorited": "Сервер не добавлен в избранное",
"Urban Terror version for which this profile applies.": "Версия Urban Terror для которой будет применяться этот профиль.",
"Show CVars": "Показать CVar'ы",
"Delete": "Удалить",
"URTrator - Server CVars": "URTrator - Server CVars",
"Hide private servers": "Скрыть приватные серверы",
"Profile:": "Профиль:",
"Update selected server": "Обновить выбранный сервер",
"Urban Terror version:": "Версия Urban Terror:",
"Cannot delete server from favorites.\\n\\nServer isn't favorited.": "Невозможно удалить сервер из избранного.\n\nСервер не был ранее добавлен в избранное.",
"Updating selected server...": "Обновление выбранного сервера...",
"Profile wasn't selected.\\n\\nPlease, select valid profile for this server.\\nIf you haven't add profiles yet - you can do it\\nin options on \\\"Urban Terror\\\" tab.": "Профиль не выбран.\n\nПожалуйста, выберите правильный профиль для этого сервера. Если вы еще не создавали профиль - вы можете сделать это в настройках на вкладке \\\"Urban Terror\\\".",
"Show / Hide URTrator": "Показать / Скрыть URTrator",
"_Options": "_Настройки",
"Status": "Статус",
"Remove from favorites": "Удалить из избранного",
"Servers": "Серверы",
"Cancel": "Отмена",
"Show only servers which uses selected version of Urban Terror": "Показывать только сервера, которые используют выбранную версию Urban Terror",
"User didn't select valid profile, mismatch with server's version.": "Пользователь выбрал неправильный профиль, несовпадение с версией сервера.",
"Remove selected server from favorites": "Удалить выбранный сервер из избранного",
"Exit": "Выход",
"Edit selected profile. Do nothing if no profile was selected.": "Редактировать выбранный профиль. Не делает ничего, если профиль не выбран.",
"Current map": "Текущая карта",
"Urban Terror": "Urban Terror",
"Edit": "Редактировать",
"Urban Terror is launched with profile": "Urban Terror запущен с профилем",
"Browse": "Найти",
"Launch!": "Запуск!",
"Password we will use for server": "Пароль, который будет использоваться для подключения к серверу",
"Show server's CVars": "Показать параметры сервера",
"Hide offline servers": "Скрыть отключенные сервера",
"Profile name:": "Имя профиля:",
"Mode": "Режим",
"Timeout which will trigger servers information update, in minutes.": "Таймаут обновления информации о серверах, в минутах.",
"Profile name": "Имя профиля",
"No server selected.\\n\\nPlease, select a server to continue connecting.": "Сервер не выбран.\n\nВыберите сервер для соединения.",
"Invalid game profile specified for favorite server.\\n\\nPlease, edit your favorite server, select valid profile and retry.": "Неправильный профиль игры выбран в настройках избранного сервера.\n\nПожалуйста, отредактируйте сервер, выберите правильный профиль и попробуйте еще раз.",
"No": "Нет",
"Close": "Закрыть",
"Hide offline servers on Favorites tab": "Скрыть отключенные сервера на вкладке \"Избранное\"",
"Hide servers which requires password to enter": "Скрыть сервера, которые требуют пароль для соединения",
"URTrator - {{ action }} favorite server": "URTrator - {{ action }} избранный сервер",
"Servers updated.": "Сервера обновлены.",
"Add to favorites": "Добавить в избранное",
"_?": "_?",
"No server selected.": "Сервер не выбран.",
"Public": "Публичный",
"Additional parameters:": "Дополнительные параметры:",
"Update": "Обновить",
"Empty path to binary!\\nThis profile will be unusable if you\\nwill not provide path to binary!": "Пустой путь до исполняемого файла!\nПрофиль будет невозможно использовать\nесли вы не выберите исполняемый файл!",
"Update profile": "Обновить профиль",
"Quick connect": "Быстрое соединение",
"Urban Terror binary:": "Исполняемый файл Urban Terror:",
"Servers update timeout (minutes)": "Таймаут обновления серверов (в минутах)",
"E_xit": "Вы_ход",
"Start Urban Terror in another X session?": "Запускать Urban Terror в другой X-сессии?",
"User didn't select valid profile.": "Пользователь не выбрал правильный профиль.",
"Name": "Имя",
"Add profile": "Добавить профиль",
"Server address is empty.\\n\\nServers without address cannot be added.": "Адрес сервера пустой.\n\nСервера без адреса не могут быть добавлены.",
"Profile which will be used for launching": "Профиль, который будет использоваться для запуска",
"Server address we will connect to": "Адрес сервера к которому будем подключаться",
"Invalid game profile selected.\\n\\nSelected profile have different game version than server.\\nPlease, select valid profile and retry.": "Выбран неправильный игровой профиль.\n\nВыбранный профиль создан для другой версии игры\nчем используемая на сервере.\n\nВыберите правильный профиль и попробуйте\nеще раз.",
"Password:": "Пароль:",
"Selected server is offline.\\n\\nWould you still want to launch Urban Terror?\\nIt will just launch a game, without connecting to\\nany server.": "Выбранный сервер отключен.\n\nВы все еще хотите запустить Urban Terror?\nЭто просто запустит игру, без соединения\nс каким-либо серверов.",
"Empty profile name!\\nProfile must be named somehow.": "Пустое имя профиля!\n\nПрофиль должен иметь имя.",
"Update server information": "Обновить информацию о сервере",
"Passworded": "Приватный",
"URTrator - Update Urban Terror profile": "URTrator - Обновить игровой профиль",
"Server address:": "Адрес сервера:",
"Update all servers in currently selected tab": "Обновить все сервера в текущей вкладке",
"Show only servers which uses selected game mode": "Показывать только сервера, которые \nиспользуют выбранный игровой режим",
"Update only selected server": "Обновить только выбранный сервер",
"URTrator - Options": "URTrator - Настройки",
"Hide offline servers on Servers tab": "Скрывать отключенные сервера на вкладке \"Серверы\"",
"Urban Terror servers browser and game launcher": "Браузер серверов и запускатор Urban Terror",
"Version": "Версия",
"URTrator is ready": "URTrator готов",
"Server information": "Информация о сервере",
"Map": "Карта",
"Ping": "Пинг",
"Updating servers...": "Обновление серверов...",
"Drop database data...": "Удалить данные из БД...",
"Frags": "Фраги",
"IP": "IP",
"Launch Urban Terror": "Запустить Urban Terror",
"Game profile:": "Игровой профиль:",
"Select a server we will connect to!": "Выберите сервер для подключения!",
"Remove ~/.config/urtrator/database.sqlite3 manually!": "Удалите ~/.config/urtrator/database.sqlite3 вручную!",
"Update all servers": "Обновить все серверы",
"Game mode": "Режим игры",
"There will be some appearance configuration options soon.": "Скоро тут будет настройка внешнего вида.",
"Add": "Добавить",
"Should servers be automatically updated?": "Должны ли серверы обновляться автоматически?",
"Game profile with same name already exist.\\nRename profile for saving.": "Игровой профиль с таким именем уже существует.\nВыберите другое имя для сохранения.",
"URTrator - Select Urban Terror binary": "URTrator - Выбор исполняемого файла Urban Terror",
"Key": "Ключ",
"Players": "Игроки",
"Player name": "Имя игрока",
"This how you will see profile on profiles lists.": "Так профиль будет отображаться в списке профилей.",
"Add selected server to favorites": "Добавить выбранный сервер в избранное",
"Edit selected favorite server": "Редактировать выбранный избранный сервер",
"Server name:": "Имя сервера:",
"Edit favorite": "Редактировать избранное",
"All versions": "Все версии",
"Favorites": "Избранное",
"If this is checked, Urban Terror will be launched in another X session.\\n\\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin.": "Если эта опция включена, то Urban Terror будет запущен в другой X-сессии.\n\nЭто может помочь если вы замечаете графические лаги (подергивания) и падение FPS при использовании композитных WM, типа Mutter или KWin.",
"Address of master server. Specify in form: addr:port.": "Адрес мастер-сервера. Указывайте в формате адрес:порт.",
"About _URTrator...": "О _URTrator...",
"All available profiles": "Все доступные профили",
"General": "Общее",
"URTrator - Add Urban Terror profile": "URTrator - Добавить игровой профиль",
"Copy server's credentials to clipboard for sharing": "Скопировать данные сервера в буфер обмена",
"You are about to drop whole database data.\\n\\nAfter clicking \\\"YES\\\" ALL data in database (servers, profiles, settings, etc.)\\nwill be lost FOREVER. Are you sure?": "Вы собираетесь удалить все данные из БД.\n\nПосле нажатия кнопки \\\"Да\\\" ВСЕ данные из БД (серверы, профили, настройки и т.д.)\nбудут удалены НАВСЕГДА. Вы уверены?",
"Urban Terror version": "Версия Urban Terror",
"Some options require application restart to be applied.": "Некоторые настройки для применения требуют перезапуска приложения.",
"Invalid binary selected!\\nAccording to your OS, it should be": "Выбран неправильный исполняемый файл!\nСогласно определенной ОС, это должен быть",
"Show icon in tray": "Показывать значок в трее",
"All gamemodes": "Все режимы игры",
"Nickname we will use": "Ник, который будет использоваться",
"Yes": "Да",
"Should URTrator check for updates and update itself? Not working now.": "Должен ли URTrator проверять обновления и самообновляться? Пока не работает.",
"Game version": "Версия игры",
"Servers updating": "Обновление серверов",
"Servers autoupdate": "Автообновление серверов"
}

87
translations_update.py Executable file
View File

@ -0,0 +1,87 @@
#!/usr/bin/env python3
# URTator - Urban Terror server browser and game launcher, written in
# Go.
#
# Copyright (c) 2016-2017, Stanislav N. aka pztrn.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This is a translations updating tool. It will parse thru all
# source, compile JSONs and put them into "translations/en_US"
# directory for later use.
import glob
import json
import os
import sys
FILES_TO_TRANSLATE = []
TRANSLATABLE_JSON = {}
SOURCE_PATH = ""
def get_files_for_translation():
print("Getting files list for translation...")
SOURCE_PATH = os.path.dirname(os.path.realpath(__file__))
print("Directory:", SOURCE_PATH)
for file in glob.iglob(os.path.join(SOURCE_PATH, "**", "*.go")):
print(file)
FILES_TO_TRANSLATE.append(file)
for file in glob.iglob(os.path.join(SOURCE_PATH, "ui", "**", "*.go")):
print(file)
FILES_TO_TRANSLATE.append(file)
# Append main file also.
FILES_TO_TRANSLATE.append("urtrator.go")
print("Found " + str(len(FILES_TO_TRANSLATE)) + " files.")
def generate_default_translation():
print("Generating default translations...")
for file in FILES_TO_TRANSLATE:
translations_found = False
file_data = open(os.path.join(SOURCE_PATH, file), "r").read().split("\n")
for line in file_data:
if "Translator.Translate(" in line:
translations_found = True
translatable_string = line.split("Translator.Translate(")[1].split("\", ")[0]
# Skip variables translation.
if translatable_string[1] != "\"":
continue
translatable_string = translatable_string[1:]
TRANSLATABLE_JSON[translatable_string] = translatable_string
# Just a stat :)
print("Got " + str(len(TRANSLATABLE_JSON)) + " translations.")
def save_sections():
print("Saving translations...")
file_to_write = open(os.path.join(SOURCE_PATH, "translations", "en_US", "strings.json"), "w")
file_to_write.write(json.dumps(TRANSLATABLE_JSON, indent = 4))
file_to_write.close()
print("Saving empty translation...")
for item in TRANSLATABLE_JSON:
TRANSLATABLE_JSON[item] = ""
file_to_write = open(os.path.join(SOURCE_PATH, "translations", "empty", "strings.json"), "w")
file_to_write.write(json.dumps(TRANSLATABLE_JSON, indent = 4))
file_to_write.close()
get_files_for_translation()
generate_default_translation()
save_sections()

15
translator/exported.go Normal file
View File

@ -0,0 +1,15 @@
// URTator - Urban Terror server browser and game launcher, written in
// Go.
//
// Copyright (c) 2016, Stanslav N. a.k.a pztrn (or p0z1tr0n)
// All rights reserved.
//
// Licensed under Terms and Conditions of GNU General Public License
// version 3 or any higher.
// ToDo: put full text of license here.
package translator
func New() *Translator {
t := Translator{}
return &t
}

127
translator/translator.go Normal file
View File

@ -0,0 +1,127 @@
// URTator - Urban Terror server browser and game launcher, written in
// Go.
//
// Copyright (c) 2016, Stanslav N. a.k.a pztrn (or p0z1tr0n)
// All rights reserved.
//
// Licensed under Terms and Conditions of GNU General Public License
// version 3 or any higher.
// ToDo: put full text of license here.
// This is translator - package which translates everything in languages
// other than en_US.
// Available only on unixes for now, Windows version in ToDo.
package translator
import (
// stdlib
"encoding/json"
"fmt"
"io/ioutil"
"path/filepath"
"strings"
)
type Translator struct {
// Currently active language.
Language string
// Translations.
translations map[string]map[string]string
// Path to translations files.
translationsPath string
}
// Formats string from passed map.
// We expect replaceable strings to be named as:
//
// {{ VAR }}
//
// We will change whole "{{ VAR }}" to params["VAR"] value. E.g.:
//
// data = "Version {{ version }}"
// map = map[string]string{"version": "0.1"}
//
// will be formatted as:
//
// result = "Version 0.1"
//
// Also note that we will replace ALL occurences of "{{ VAR }}" within string!
// All untranslated variables will not be touched at all.
func (t *Translator) formatFromMap(data string, params map[string]string) string {
new_data := data
for k, v := range params {
new_data = strings.Replace(new_data, "{{ " + k + " }}", v, -1)
}
return new_data
}
// Translator initialization.
func (t *Translator) Initialize() {
fmt.Println("Initializing translations...")
// Initialize storages.
t.translations = make(map[string]map[string]string)
t.translationsPath = ""
// Getting locale name from environment.
// ToDo: Windows compatability. Possible reference:
// https://github.com/cloudfoundry-attic/jibber_jabber/blob/master/jibber_jabber_windows.go
t.detectLanguage()
fmt.Println("Using translations for '" + t.Language + "'")
err := t.detectTranslationsDirectory()
if err == nil {
t.loadTranslations()
} else {
fmt.Println("Skipping translations loading due to missing translations directory.")
}
}
// Load translations into memory.
func (t *Translator) loadTranslations() {
fmt.Println("Loading translations for language " + t.Language)
t.translations[t.Language] = make(map[string]string)
if t.translationsPath != "" {
files_list, _ := ioutil.ReadDir(t.translationsPath)
if len(files_list) > 0 {
for i := range files_list {
// Read file.
file_path := filepath.Join(t.translationsPath, files_list[i].Name())
file_data, _ := ioutil.ReadFile(file_path)
var trans map[string]string
json.Unmarshal(file_data, &trans)
// Assign parsed translations to language code.
t.translations[t.Language] = trans
}
}
}
}
// Actual translation function.
// Parameters:
// * str - raw string from source which we will try to translate.
// * params - map[string]string with parameters to replace in string.
//
// If string wasn't found in loaded translations for current language
// we will use English as fallback.
// Translates passed data from loaded translations file.
// Returns passed data without changes if translation wasn't found.
func (t *Translator) Translate(data string, params map[string]string) string {
val, ok := t.translations[t.Language][data]
if !ok {
if params != nil && len(params) > 0 {
return t.formatFromMap(data, params)
} else {
return data
}
}
if params != nil && len(params) > 0 {
return t.formatFromMap(val, params)
}
return val
}

View File

@ -0,0 +1,90 @@
// URTator - Urban Terror server browser and game launcher, written in
// Go.
//
// Copyright (c) 2016-2017, Stanislav N. aka pztrn.
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// +build !windows
package translator
import (
// stdlib
"errors"
"fmt"
"os"
"path/filepath"
"strings"
)
// Detect language on Unices.
func (t *Translator) detectLanguage() {
// Use LC_ALL first.
t.Language = os.Getenv("LC_ALL")
// If LC_ALL is empty - use LANG.
if t.Language == "" {
t.Language = os.Getenv("LANG")
}
// If still nothing - force "en_US" as default locale. Otherwise
// split language string by "." and take first part.
// Note: en_US is a default thing, so you will not found anything
// in "translations" directory!
if t.Language == "" {
fmt.Println("No locale data for current user found, using default (en_US)...")
t.Language = "en_US"
} else {
t.Language = strings.Split(t.Language, ".")[0]
}
}
func (t *Translator) detectTranslationsDirectory() error {
// Try to use directory near binary.
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
// ..which can be overriden by URTRATOR_BINDIR environment variable.
// Useful for developers.
envdir := os.Getenv("URTRATOR_BINDIR")
if envdir != "" {
dir = envdir
}
translations_dir := filepath.Join(dir, "translations")
_, err := os.Stat(translations_dir)
if err != nil {
fmt.Println("Translations wasn't found near binary!")
// As we're using JSON translation storage, it should be
// put in /usr/share/urtrator/translations by package
// maintainers in distros.
fmt.Println("Trying /usr/share/urtrator/translations...")
_, err := os.Stat("/usr/share/urtrator/translations")
if err != nil {
t.Language = "en_US"
fmt.Println("Translations unavailable, forcing en_US language code")
} else {
t.translationsPath = "/usr/share/urtrator/translations"
}
} else {
t.translationsPath = translations_dir
}
if t.translationsPath != "" {
t.translationsPath = filepath.Join(t.translationsPath, t.Language)
} else {
return errors.New("No translations directory was detected!")
}
return nil
}

View File

@ -0,0 +1,43 @@
// URTator - Urban Terror server browser and game launcher, written in
// Go.
//
// Copyright (c) 2016-2017, Stanislav N. aka pztrn.
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// +build windows
package translator
import (
// stdlib
"errors"
"fmt"
"os"
)
// Detect language on Unices.
func (t *Translator) detectLanguage() {
fmt.Println("ToDo! Forcing en_US for now!")
t.Language = "en_US"
}
func (t *Translator) detectTranslationsDirectory() error {
// Translations MUST reside in directory neear binary!
// ToDo: more checks.
t.translationsPath, _ := filepath.Abs(filepath.Dir(os.Args[0]))
return nil
}

View File

@ -21,7 +21,7 @@ func ShowAboutDialog() {
ad := gtk.NewAboutDialog()
ad.SetProgramName("URTrator")
ad.SetComments("Urban Terror servers browser and game launcher")
ad.SetComments(ctx.Translator.Translate("Urban Terror servers browser and game launcher", nil))
ad.SetVersion(common.URTRATOR_VERSION)
ad.SetWebsite("http://urtrator.pztrn.name")
ad.SetLogo(logo)

View File

@ -109,9 +109,9 @@ func (f *FavoriteDialog) InitializeUpdate(server *datamodels.Server) {
func (f *FavoriteDialog) initializeWindow() {
f.window = gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
if f.update {
f.window.SetTitle("URTrator - Updating favorite server")
f.window.SetTitle(ctx.Translator.Translate("URTrator - {{ action }} favorite server", map[string]string{"action": "Update"}))
} else {
f.window.SetTitle("URTrator - New favorite server")
f.window.SetTitle(ctx.Translator.Translate("URTrator - {{ action }} favorite server", map[string]string{"action": "Add"}))
}
f.window.Connect("destroy", f.Close)
f.window.SetPosition(gtk.WIN_POS_CENTER)
@ -137,7 +137,7 @@ func (f *FavoriteDialog) initializeWindow() {
f.vbox.PackStart(table, true, true, 5)
// Server name.
srv_name_label := gtk.NewLabel("Server name:")
srv_name_label := gtk.NewLabel(ctx.Translator.Translate("Server name:", nil))
srv_name_label.SetAlignment(0, 0)
table.Attach(srv_name_label, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK, 5, 5)
@ -145,7 +145,7 @@ func (f *FavoriteDialog) initializeWindow() {
table.Attach(f.server_name, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
// Server address.
srv_addr_label := gtk.NewLabel("Server address:")
srv_addr_label := gtk.NewLabel(ctx.Translator.Translate("Server address:", nil))
srv_addr_label.SetAlignment(0, 0)
table.Attach(srv_addr_label, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
@ -153,7 +153,7 @@ func (f *FavoriteDialog) initializeWindow() {
f.server_address = gtk.NewEntry()
srv_addr_hbox.PackStart(f.server_address, true, true, 0)
srv_addr_update_btn := gtk.NewButton()
srv_addr_update_btn.SetTooltipText("Update server information")
srv_addr_update_btn.SetTooltipText(ctx.Translator.Translate("Update server information", nil))
srv_addr_update_btn_image := gtk.NewImageFromStock(gtk.STOCK_REDO, gtk.ICON_SIZE_SMALL_TOOLBAR)
srv_addr_update_btn.SetImage(srv_addr_update_btn_image)
srv_addr_update_btn.Clicked(f.updateServerInfo)
@ -164,7 +164,7 @@ func (f *FavoriteDialog) initializeWindow() {
table.Attach(srv_addr_hbox, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
// Server password.
srv_pass_label := gtk.NewLabel("Password:")
srv_pass_label := gtk.NewLabel(ctx.Translator.Translate("Password:", nil))
srv_pass_label.SetAlignment(0, 0)
table.Attach(srv_pass_label, 0, 1, 2, 3, gtk.FILL, gtk.SHRINK, 5, 5)
@ -172,7 +172,7 @@ func (f *FavoriteDialog) initializeWindow() {
table.Attach(f.server_password, 1, 2, 2, 3, gtk.FILL, gtk.FILL, 5, 5)
// Profile to use.
profile_label := gtk.NewLabel("Profile:")
profile_label := gtk.NewLabel(ctx.Translator.Translate("Profile:", nil))
profile_label.SetAlignment(0, 0)
table.Attach(profile_label, 0, 1, 3, 4, gtk.FILL, gtk.SHRINK, 5, 5)
@ -190,11 +190,11 @@ func (f *FavoriteDialog) initializeWindow() {
sep := gtk.NewHSeparator()
buttons_hbox.PackStart(sep, true, true, 5)
// OK-Cancel buttons.
cancel_button := gtk.NewButtonWithLabel("Cancel")
cancel_button := gtk.NewButtonWithLabel(ctx.Translator.Translate("Cancel", nil))
cancel_button.Clicked(f.closeByCancel)
buttons_hbox.PackStart(cancel_button, false, true, 5)
ok_button := gtk.NewButtonWithLabel("OK")
ok_button := gtk.NewButtonWithLabel(ctx.Translator.Translate("OK", nil))
ok_button.Clicked(f.saveFavorite)
buttons_hbox.PackStart(ok_button, false, true, 5)
@ -213,7 +213,7 @@ func (f *FavoriteDialog) saveFavorite() error {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Server address is empty.\n\nServers without address cannot be added."
mbox_string := ctx.Translator.Translate("Server address is empty.\n\nServers without address cannot be added.", nil)
m := gtk.NewMessageDialog(f.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -236,7 +236,7 @@ func (f *FavoriteDialog) saveFavorite() error {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Profile wasn't selected.\n\nPlease, select valid profile for this server.\nIf you haven't add profiles yet - you can do it\nin options on \"Urban Terror\" tab."
mbox_string := ctx.Translator.Translate("Profile wasn't selected.\n\nPlease, select valid profile for this server.\nIf you haven't add profiles yet - you can do it\nin options on \"Urban Terror\" tab.", nil)
m := gtk.NewMessageDialog(f.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()

View File

@ -161,7 +161,7 @@ func (m *MainWindow) addToFavorites() {
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
server_address := ""
if !strings.Contains(current_tab, "Favorites") {
if !strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
server_address = m.getIpFromServersList(current_tab)
}
@ -271,14 +271,14 @@ func (m *MainWindow) deleteFromFavorites() {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Cannot delete server from favorites.\n\nServer isn't favorited."
mbox_string := ctx.Translator.Translate("Cannot delete server from favorites.\n\nServer isn't favorited.", nil)
d := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, mbox_string)
d.Response(func() {
d.Destroy()
})
d.Run()
} else {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Server isn't favorited</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Server isn't favorited", nil) + "</span></markup>"})
}
}
@ -293,7 +293,7 @@ func (m *MainWindow) dropDatabasesData() {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "You are about to drop whole database data.\n\nAfter clicking \"YES\" ALL data in database (servers, profiles, settings, etc.)\nwill be lost FOREVER. Are you sure?"
mbox_string := ctx.Translator.Translate("You are about to drop whole database data.\n\nAfter clicking \"YES\" ALL data in database (servers, profiles, settings, etc.)\nwill be lost FOREVER. Are you sure?", nil)
d := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO, mbox_string)
d.Connect("response", func(resp *glib.CallbackContext) {
if resp.Args(0) == 4294967287 {
@ -305,7 +305,7 @@ func (m *MainWindow) dropDatabasesData() {
})
d.Run()
} else {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Remove ~/.config/urtrator/database.sqlite3 manually!</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Remove ~/.config/urtrator/database.sqlite3 manually!", nil) + "</span></markup>"})
}
if will_continue {
@ -423,7 +423,7 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
// Hide servers that using different version than selected in
// filter?
if m.all_servers_version.GetActiveText() != "All versions" && m.all_servers_version.GetActiveText() != server.Server.Version {
if m.all_servers_version.GetActiveText() != ctx.Translator.Translate("All versions", nil) && m.all_servers_version.GetActiveText() != server.Server.Version {
if server.AllServersIterInList && server.AllServersIterSet {
m.all_servers_store.Remove(iter)
server.AllServersIterInList = false
@ -434,7 +434,7 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
// Hide servers that using different gamemode than selected in
// filter?
gm_int_as_str := strconv.Itoa(m.all_servers_gamemode.GetActive())
if m.all_servers_gamemode.GetActiveText() != "All gamemodes" && gm_int_as_str != server.Server.Gamemode {
if m.all_servers_gamemode.GetActiveText() != ctx.Translator.Translate("All gamemodes", nil) && gm_int_as_str != server.Server.Gamemode {
if server.AllServersIterInList && server.AllServersIterSet {
m.all_servers_store.Remove(iter)
server.AllServersIterInList = false
@ -449,7 +449,7 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
if server.Server.Name == "" && server.Server.Players == "" {
m.all_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["IP"], server.Server.Ip + ":" + server.Server.Port)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
} else {
if ping > 9000 {
m.all_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
@ -462,13 +462,13 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
m.all_servers_store.SetValue(iter, 1, m.server_public_pic.GPixbuf)
}
server_name := ctx.Colorizer.Fix(server.Server.Name)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["Name"], server_name)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["Mode"], m.getGameModeName(server.Server.Gamemode))
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["Map"], server.Server.Map)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["Players"], server.Server.Players + "/" + server.Server.Bots + "/" + server.Server.Maxplayers)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["Ping"], server.Server.Ping)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["Version"], server.Server.Version)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"]["IP"], server.Server.Ip + ":" + server.Server.Port)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], server_name)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Mode", nil)], m.getGameModeName(server.Server.Gamemode))
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Map", nil)], server.Server.Map)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], server.Server.Players + "/" + server.Server.Bots + "/" + server.Server.Maxplayers)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], server.Server.Ping)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("Version", nil)], server.Server.Version)
m.all_servers_store.SetValue(iter, m.column_pos["Servers"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
}
}
}
@ -506,7 +506,7 @@ func (m *MainWindow) loadFavoriteServers(data map[string]string) {
// Hide servers that using different version than selected in
// filter?
if m.fav_servers_version.GetActiveText() != "All versions" && m.fav_servers_version.GetActiveText() != server.Server.Version {
if m.fav_servers_version.GetActiveText() != ctx.Translator.Translate("All versions", nil) && m.fav_servers_version.GetActiveText() != server.Server.Version {
if server.FavServersIterInList && server.FavServersIterSet {
m.fav_servers_store.Remove(iter)
server.FavServersIterInList = false
@ -517,7 +517,7 @@ func (m *MainWindow) loadFavoriteServers(data map[string]string) {
// Hide servers that using different gamemode than selected in
// filter?
gm_int_as_str := strconv.Itoa(m.fav_servers_gamemode.GetActive())
if m.fav_servers_gamemode.GetActiveText() != "All gamemodes" && gm_int_as_str != server.Server.Gamemode {
if m.fav_servers_gamemode.GetActiveText() != ctx.Translator.Translate("All gamemodes", nil) && gm_int_as_str != server.Server.Gamemode {
if server.FavServersIterInList && server.FavServersIterSet {
m.fav_servers_store.Remove(iter)
server.FavServersIterInList = false
@ -545,7 +545,7 @@ func (m *MainWindow) loadFavoriteServers(data map[string]string) {
if server.Server.Name == "" && server.Server.Players == "" {
m.fav_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["IP"], server.Server.Ip + ":" + server.Server.Port)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
} else {
if ping > 9000 {
m.fav_servers_store.SetValue(iter, 0, m.server_offline_pic.GPixbuf)
@ -558,13 +558,13 @@ func (m *MainWindow) loadFavoriteServers(data map[string]string) {
m.fav_servers_store.SetValue(iter, 1, m.server_public_pic.GPixbuf)
}
server_name := ctx.Colorizer.Fix(server.Server.Name)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["Name"], server_name)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["Mode"], m.getGameModeName(server.Server.Gamemode))
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["Map"], server.Server.Map)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["Players"], server.Server.Players + "/" + server.Server.Bots + "/" + server.Server.Maxplayers)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["Ping"], server.Server.Ping)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["Version"], server.Server.Version)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"]["IP"], server.Server.Ip + ":" + server.Server.Port)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], server_name)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Mode", nil)], m.getGameModeName(server.Server.Gamemode))
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Map", nil)], server.Server.Map)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], server.Server.Players + "/" + server.Server.Bots + "/" + server.Server.Maxplayers)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], server.Server.Ping)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("Version", nil)], server.Server.Version)
m.fav_servers_store.SetValue(iter, m.column_pos["Favorites"][ctx.Translator.Translate("IP", nil)], server.Server.Ip + ":" + server.Server.Port)
}
}
}
@ -597,23 +597,23 @@ func (m *MainWindow) tabChanged() {
fmt.Println(current_tab)
m.use_other_servers_tab = true
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
m.fav_servers.Emit("cursor-changed")
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
m.all_servers.Emit("cursor-changed")
}
m.use_other_servers_tab = false
}
func (m *MainWindow) serversUpdateCompleted(data map[string]string) {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "Servers updated."})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": ctx.Translator.Translate("Servers updated.", nil)})
// Trigger "selection-changed" events on currently active tab's
// servers list.
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
m.all_servers.Emit("cursor-changed")
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
m.fav_servers.Emit("cursor-changed")
}
@ -650,9 +650,9 @@ func (m *MainWindow) showHide() {
func (m *MainWindow) showServerCVars() {
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
if m.use_other_servers_tab {
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
current_tab = "Favorites"
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
current_tab = "Servers"
}
}
@ -668,9 +668,9 @@ func (m *MainWindow) showShortServerInformation() {
m.players_info_store.Clear()
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
if m.use_other_servers_tab {
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
current_tab = "Favorites"
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
current_tab = "Servers"
}
}
@ -687,49 +687,49 @@ func (m *MainWindow) showShortServerInformation() {
// Server's name.
iter := new(gtk.TreeIter)
m.server_info_store.Append(iter)
m.server_info_store.SetValue(iter, 0, "Server's name")
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Server's name", nil))
m.server_info_store.SetValue(iter, 1, ctx.Colorizer.Fix(parsed_general_data["sv_hostname"]))
delete(parsed_general_data, "sv_hostname")
// Game version.
iter = new(gtk.TreeIter)
m.server_info_store.Append(iter)
m.server_info_store.SetValue(iter, 0, "Game version")
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Game version", nil))
m.server_info_store.SetValue(iter, 1, parsed_general_data["g_modversion"])
delete(parsed_general_data, "g_modversion")
// Players.
iter = new(gtk.TreeIter)
m.server_info_store.Append(iter)
m.server_info_store.SetValue(iter, 0, "Players")
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Players", nil))
m.server_info_store.SetValue(iter, 1, server_info.Players + " of " + parsed_general_data["sv_maxclients"] + " (" + server_info.Bots + " bots)")
delete(parsed_general_data, "sv_maxclients")
// Ping
iter = new(gtk.TreeIter)
m.server_info_store.Append(iter)
m.server_info_store.SetValue(iter, 0, "Ping")
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Ping", nil))
m.server_info_store.SetValue(iter, 1, server_info.Ping + " ms")
// Game mode
iter = new(gtk.TreeIter)
m.server_info_store.Append(iter)
m.server_info_store.SetValue(iter, 0, "Game mode")
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Game mode", nil))
m.server_info_store.SetValue(iter, 1, m.gamemodes[server_info.Gamemode])
// Map name
iter = new(gtk.TreeIter)
m.server_info_store.Append(iter)
m.server_info_store.SetValue(iter, 0, "Current map")
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Current map", nil))
m.server_info_store.SetValue(iter, 1, server_info.Map)
// Private or public?
iter = new(gtk.TreeIter)
m.server_info_store.Append(iter)
m.server_info_store.SetValue(iter, 0, "Passworded")
passworded_status := "<markup><span foreground=\"green\">No</span></markup>"
m.server_info_store.SetValue(iter, 0, ctx.Translator.Translate("Passworded", nil))
passworded_status := "<markup><span foreground=\"green\">" + ctx.Translator.Translate("No", nil) + "</span></markup>"
if server_info.IsPrivate == "1" {
passworded_status = "<markup><span foreground=\"red\">Yes</span></markup>"
passworded_status = "<markup><span foreground=\"red\">" + ctx.Translator.Translate("Yes", nil) + "</span></markup>"
}
m.server_info_store.SetValue(iter, 1, passworded_status)
@ -788,11 +788,11 @@ func (m *MainWindow) showTrayMenu(cbx *glib.CallbackContext) {
// Unlocking interface after game shut down.
func (m *MainWindow) unlockInterface() {
m.launch_button.SetSensitive(true)
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "URTrator is ready."})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": ctx.Translator.Translate("URTrator is ready.", nil)})
}
func (m *MainWindow) updateOneServer() {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Updating selected server...</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Updating selected server...", nil) + "</span></markup>"})
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
srv_address := m.getIpFromServersList(current_tab)
@ -803,19 +803,19 @@ func (m *MainWindow) updateOneServer() {
// Triggered when "Update all servers" button is clicked.
func (m *MainWindow) UpdateServers() {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Updating servers...</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Updating servers...", nil) + "</span></markup>"})
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
fmt.Println("Updating servers on tab '" + current_tab + "'...")
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
go ctx.Requester.UpdateAllServers(false)
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
go ctx.Requester.UpdateFavoriteServers()
}
}
func (m *MainWindow) UpdateServersEventHandler(data map[string]string) {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Updating servers...</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Updating servers...", nil) + "</span></markup>"})
go ctx.Requester.UpdateAllServers(true)
}

View File

@ -24,7 +24,7 @@ func (m *MainWindow) getIpFromServersList(current_tab string) string {
// Assuming that we're on "Servers" tab by default.
sel := m.all_servers.GetSelection()
model := m.all_servers.GetModel()
if strings.Contains(current_tab, "Favorites") {
if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
sel = m.fav_servers.GetSelection()
model = m.fav_servers.GetModel()
}
@ -36,9 +36,9 @@ func (m *MainWindow) getIpFromServersList(current_tab string) string {
var srv_addr string
srv_addr_gval := glib.ValueFromNative(srv_addr)
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
model.GetValue(iter, m.column_pos["Servers"]["IP"], srv_addr_gval)
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
model.GetValue(iter, m.column_pos["Favorites"]["IP"], srv_addr_gval)
}
server_address := srv_addr_gval.GetString()

View File

@ -137,9 +137,9 @@ func (m *MainWindow) Initialize() {
profile_and_launch_hbox.PackStart(sep, true, true, 5)
// Profile selection.
profiles_label := gtk.NewLabel("Game profile:")
profiles_label := gtk.NewLabel(ctx.Translator.Translate("Game profile:", nil))
m.profiles = gtk.NewComboBoxText()
m.profiles.SetTooltipText("Profile which will be used for launching")
m.profiles.SetTooltipText(ctx.Translator.Translate("Profile which will be used for launching", nil))
profile_and_launch_hbox.PackStart(profiles_label, false, true, 5)
profile_and_launch_hbox.PackStart(m.profiles, false, true, 5)
@ -149,8 +149,8 @@ func (m *MainWindow) Initialize() {
profile_and_launch_hbox.PackStart(sepp, false, true, 5)
// Game launching button.
m.launch_button = gtk.NewButtonWithLabel("Launch!")
m.launch_button.SetTooltipText("Launch Urban Terror")
m.launch_button = gtk.NewButtonWithLabel(ctx.Translator.Translate("Launch!", nil))
m.launch_button.SetTooltipText(ctx.Translator.Translate("Launch Urban Terror", nil))
m.launch_button.Clicked(m.launchGame)
launch_button_image := gtk.NewImageFromPixbuf(logo.ScaleSimple(24, 24, gdkpixbuf.INTERP_HYPER))
m.launch_button.SetImage(launch_button_image)
@ -171,7 +171,7 @@ func (m *MainWindow) Initialize() {
ctx.Eventer.LaunchEvent("loadAllServers", map[string]string{})
ctx.Eventer.LaunchEvent("loadFavoriteServers", map[string]string{})
ctx.Eventer.LaunchEvent("initializeTasksForMainWindow", map[string]string{})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "URTrator is ready."})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": ctx.Translator.Translate("URTrator is ready.", nil)})
// Set flag that shows to other parts that we're initialized.
m.initialized = true
@ -198,13 +198,13 @@ func (m *MainWindow) InitializeMainMenu() {
m.vbox.PackStart(m.menubar, false, false, 0)
// File menu.
fm := gtk.NewMenuItemWithMnemonic("File")
fm := gtk.NewMenuItemWithMnemonic(ctx.Translator.Translate("File", nil))
m.menubar.Append(fm)
file_menu := gtk.NewMenu()
fm.SetSubmenu(file_menu)
// Options.
options_menu_item := gtk.NewMenuItemWithMnemonic("_Options")
options_menu_item := gtk.NewMenuItemWithMnemonic(ctx.Translator.Translate("_Options", nil))
file_menu.Append(options_menu_item)
options_menu_item.Connect("activate", m.options_dialog.ShowOptionsDialog)
@ -213,18 +213,18 @@ func (m *MainWindow) InitializeMainMenu() {
file_menu.Append(file_menu_sep1)
// Exit.
exit_menu_item := gtk.NewMenuItemWithMnemonic("E_xit")
exit_menu_item := gtk.NewMenuItemWithMnemonic(ctx.Translator.Translate("E_xit", nil))
file_menu.Append(exit_menu_item)
exit_menu_item.Connect("activate", m.Close)
// About menu.
am := gtk.NewMenuItemWithMnemonic("_About")
am := gtk.NewMenuItemWithMnemonic(ctx.Translator.Translate("_?", nil))
m.menubar.Append(am)
about_menu := gtk.NewMenu()
am.SetSubmenu(about_menu)
// About app item.
about_app_item := gtk.NewMenuItemWithMnemonic("About _URTrator...")
about_app_item := gtk.NewMenuItemWithMnemonic(ctx.Translator.Translate("About _URTrator...", nil))
about_menu.Append(about_app_item)
about_app_item.Connect("activate", ShowAboutDialog)
@ -233,7 +233,7 @@ func (m *MainWindow) InitializeMainMenu() {
about_menu.Append(about_menu_sep1)
// Drop databases thing.
about_menu_drop_database_data_item := gtk.NewMenuItemWithMnemonic("Drop database data...")
about_menu_drop_database_data_item := gtk.NewMenuItemWithMnemonic(ctx.Translator.Translate("Drop database data...", nil))
about_menu.Append(about_menu_drop_database_data_item)
about_menu_drop_database_data_item.Connect("activate", m.dropDatabasesData)
}
@ -242,7 +242,7 @@ func (m *MainWindow) InitializeMainMenu() {
func (m *MainWindow) initializeSidebar() {
sidebar_vbox := gtk.NewVBox(false, 0)
server_info_frame := gtk.NewFrame("Server information")
server_info_frame := gtk.NewFrame(ctx.Translator.Translate("Server information", nil))
sidebar_vbox.PackStart(server_info_frame, true, true, 5)
si_vbox := gtk.NewVBox(false, 0)
server_info_frame.Add(si_vbox)
@ -256,16 +256,16 @@ func (m *MainWindow) initializeSidebar() {
m.server_info = gtk.NewTreeView()
m.server_info.SetModel(m.server_info_store)
key_column := gtk.NewTreeViewColumnWithAttributes("Key", gtk.NewCellRendererText(), "markup", 0)
key_column := gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Key", nil), gtk.NewCellRendererText(), "markup", 0)
m.server_info.AppendColumn(key_column)
value_column := gtk.NewTreeViewColumnWithAttributes("Value", gtk.NewCellRendererText(), "markup", 1)
value_column := gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Value", nil), gtk.NewCellRendererText(), "markup", 1)
m.server_info.AppendColumn(value_column)
si_scroll.Add(m.server_info)
// Players information.
players_info_frame := gtk.NewFrame("Players")
players_info_frame := gtk.NewFrame(ctx.Translator.Translate("Players", nil))
sidebar_vbox.PackStart(players_info_frame, true, true, 5)
pi_scroll := gtk.NewScrolledWindow(nil, nil)
@ -276,30 +276,30 @@ func (m *MainWindow) initializeSidebar() {
m.players_info.SetModel(m.players_info_store)
pi_scroll.Add(m.players_info)
name_column := gtk.NewTreeViewColumnWithAttributes("Player name", gtk.NewCellRendererText(), "markup", 0)
name_column := gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Player name", nil), gtk.NewCellRendererText(), "markup", 0)
m.players_info.AppendColumn(name_column)
frags_column := gtk.NewTreeViewColumnWithAttributes("Frags", gtk.NewCellRendererText(), "markup", 1)
frags_column := gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Frags", nil), gtk.NewCellRendererText(), "markup", 1)
m.players_info.AppendColumn(frags_column)
ping_column := gtk.NewTreeViewColumnWithAttributes("Ping", gtk.NewCellRendererText(), "markup", 2)
ping_column := gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Ping", nil), gtk.NewCellRendererText(), "markup", 2)
m.players_info.AppendColumn(ping_column)
// Show CVars button.
show_cvars_button := gtk.NewButtonWithLabel("Show CVars")
show_cvars_button.SetTooltipText("Show server's CVars")
show_cvars_button := gtk.NewButtonWithLabel(ctx.Translator.Translate("Show CVars", nil))
show_cvars_button.SetTooltipText(ctx.Translator.Translate("Show server's CVars", nil))
show_cvars_button.Clicked(m.showServerCVars)
sidebar_vbox.PackStart(show_cvars_button, false, true, 5)
// Quick connect frame.
quick_connect_frame := gtk.NewFrame("Quick connect")
quick_connect_frame := gtk.NewFrame(ctx.Translator.Translate("Quick connect", nil))
sidebar_vbox.PackStart(quick_connect_frame, false, true, 5)
qc_vbox := gtk.NewVBox(false, 0)
quick_connect_frame.Add(qc_vbox)
// Server address.
srv_tooltip := "Server address we will connect to"
srv_label := gtk.NewLabel("Server address:")
srv_tooltip := ctx.Translator.Translate("Server address we will connect to", nil)
srv_label := gtk.NewLabel(ctx.Translator.Translate("Server address:", nil))
srv_label.SetTooltipText(srv_tooltip)
qc_vbox.PackStart(srv_label, false, true, 5)
@ -308,8 +308,8 @@ func (m *MainWindow) initializeSidebar() {
qc_vbox.PackStart(m.qc_server_address, false, true, 5)
// Password.
pass_tooltip := "Password we will use for server"
pass_label := gtk.NewLabel("Password:")
pass_tooltip := ctx.Translator.Translate("Password we will use for server", nil)
pass_label := gtk.NewLabel(ctx.Translator.Translate("Password:", nil))
pass_label.SetTooltipText(pass_tooltip)
qc_vbox.PackStart(pass_label, false, true, 5)
@ -318,8 +318,8 @@ func (m *MainWindow) initializeSidebar() {
qc_vbox.PackStart(m.qc_password, false, true, 5)
// Nickname
nick_tooltip := "Nickname we will use"
nick_label := gtk.NewLabel("Nickname:")
nick_tooltip := ctx.Translator.Translate("Nickname we will use", nil)
nick_label := gtk.NewLabel(ctx.Translator.Translate("Nickname:", nil))
nick_label.SetTooltipText(nick_tooltip)
qc_vbox.PackStart(nick_label, false, true, 5)
@ -355,13 +355,13 @@ func (m *MainWindow) initializeStorages() {
// Columns names.
// Key - default position in lists.
m.column_names = map[string]string{
"2": "Name",
"3": "Mode",
"4": "Map",
"5": "Players",
"6": "Ping",
"7": "Version",
"8": "IP",
"2": ctx.Translator.Translate("Name", nil),
"3": ctx.Translator.Translate("Mode", nil),
"4": ctx.Translator.Translate("Map", nil),
"5": ctx.Translator.Translate("Players", nil),
"6": ctx.Translator.Translate("Ping", nil),
"7": ctx.Translator.Translate("Version", nil),
"8": ctx.Translator.Translate("IP", nil),
}
// Real columns positions.
m.column_pos = make(map[string]map[string]int)
@ -420,7 +420,6 @@ func (m *MainWindow) initializeStorages() {
srv_public_pixbuf.SetSize(24, 24)
srv_public_pixbuf.Write(srv_public_bytes)
m.server_public_pic = srv_public_pixbuf.GetPixbuf()
fmt.Println(srv_public_pixbuf.GetFormat().GetName())
}
// Tabs widget initialization, including all child widgets.
@ -435,12 +434,12 @@ func (m *MainWindow) InitializeTabs() {
m.all_servers = gtk.NewTreeView()
swin1.Add(m.all_servers)
tab_allsrv_hbox.PackStart(swin1, true, true, 5)
m.tab_widget.AppendPage(tab_allsrv_hbox, gtk.NewLabel("Servers"))
m.tab_widget.AppendPage(tab_allsrv_hbox, gtk.NewLabel(ctx.Translator.Translate("Servers", nil)))
m.all_servers.SetModel(m.all_servers_store)
// These columns are static.
m.all_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Status", gtk.NewCellRendererPixbuf(), "pixbuf", 0))
m.all_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Public", gtk.NewCellRendererPixbuf(), "pixbuf", 1))
m.all_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Status", nil), gtk.NewCellRendererPixbuf(), "pixbuf", 0))
m.all_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Public", nil), gtk.NewCellRendererPixbuf(), "pixbuf", 1))
// ...aand lets do dynamic generation :)
// +2 because we have 2 static columns.
@ -449,19 +448,19 @@ func (m *MainWindow) InitializeTabs() {
// Check if we have column position saved. If so - use it.
// Otherwise use default position.
// Should be actual only for first launch.
position := ctx.Cfg.Cfg["/mainwindow/all_servers/" + name + "_position"]
position := ctx.Cfg.Cfg["/mainwindow/all_servers/" + ctx.Translator.Translate(name, nil) + "_position"]
if len(position) == 0 {
position = pos
}
position_int, _ := strconv.Atoi(position)
// Same for width.
width := ctx.Cfg.Cfg["/mainwindow/all_servers/" + name + "_width"]
width := ctx.Cfg.Cfg["/mainwindow/all_servers/" + ctx.Translator.Translate(name, nil) + "_width"]
if len(width) == 0 {
width = "-1"
}
width_int, _ := strconv.Atoi(width)
col := gtk.NewTreeViewColumnWithAttributes(name, gtk.NewCellRendererText(), "markup", position_int)
col := gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate(name, nil), gtk.NewCellRendererText(), "markup", position_int)
col.SetSortColumnId(position_int)
col.SetReorderable(true)
col.SetResizable(true)
@ -483,14 +482,12 @@ func (m *MainWindow) InitializeTabs() {
// Sorting.
// By default we are sorting by server name.
m.all_servers_store_sortable.SetSortColumnId(m.column_pos["Servers"]["Name"], gtk.SORT_ASCENDING)
m.all_servers_store_sortable.SetSortColumnId(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], gtk.SORT_ASCENDING)
// Sorting functions.
// Race conditions and GC crazyness appears when activated, so for
// now commenting it out.
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"]["Name"], m.sortServersByName)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"]["Players"], m.sortServersByPlayers)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"]["Ping"], m.sortServersByPing)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], m.sortServersByName)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing)
// Selection changed signal, which will update server's short info pane.
m.all_servers.Connect("cursor-changed", m.showShortServerInformation)
@ -500,8 +497,8 @@ func (m *MainWindow) InitializeTabs() {
tab_allsrv_hbox.PackStart(tab_all_srv_ctl_vbox, false, true, 5)
// Checkbox for hiding offline servers.
m.all_servers_hide_offline = gtk.NewCheckButtonWithLabel("Hide offline servers")
m.all_servers_hide_offline.SetTooltipText("Hide offline servers on Servers tab")
m.all_servers_hide_offline = gtk.NewCheckButtonWithLabel(ctx.Translator.Translate("Hide offline servers", nil))
m.all_servers_hide_offline.SetTooltipText(ctx.Translator.Translate("Hide offline servers on Servers tab", nil))
tab_all_srv_ctl_vbox.PackStart(m.all_servers_hide_offline, false, true, 5)
m.all_servers_hide_offline.Clicked(m.hideOfflineAllServers)
// Restore value of hide offline servers checkbox.
@ -516,8 +513,8 @@ func (m *MainWindow) InitializeTabs() {
}
// Checkbox for hiding passworded servers.
m.all_servers_hide_private = gtk.NewCheckButtonWithLabel("Hide private servers")
m.all_servers_hide_private.SetTooltipText("Hide servers which requires password to enter")
m.all_servers_hide_private = gtk.NewCheckButtonWithLabel(ctx.Translator.Translate("Hide private servers", nil))
m.all_servers_hide_private.SetTooltipText(ctx.Translator.Translate("Hide servers which requires password to enter", nil))
tab_all_srv_ctl_vbox.PackStart(m.all_servers_hide_private, false, true, 5)
m.all_servers_hide_private.Clicked(m.hidePrivateAllServers)
// Restore checkbox value.
@ -532,8 +529,8 @@ func (m *MainWindow) InitializeTabs() {
// Filtering by version.
m.all_servers_version = gtk.NewComboBoxText()
m.all_servers_version.SetTooltipText("Show only servers which uses selected version of Urban Terror")
m.all_servers_version.AppendText("All versions")
m.all_servers_version.SetTooltipText(ctx.Translator.Translate("Show only servers which uses selected version of Urban Terror", nil))
m.all_servers_version.AppendText(ctx.Translator.Translate("All versions", nil))
for i := range common.SUPPORTED_URT_VERSIONS {
m.all_servers_version.AppendText(common.SUPPORTED_URT_VERSIONS[i])
}
@ -549,8 +546,8 @@ func (m *MainWindow) InitializeTabs() {
// Filtering by gamemode
m.all_servers_gamemode = gtk.NewComboBoxText()
m.all_servers_gamemode.SetTooltipText("Show only servers which uses selected game mode")
m.all_servers_gamemode.AppendText("All gamemodes")
m.all_servers_gamemode.SetTooltipText(ctx.Translator.Translate("Show only servers which uses selected game mode", nil))
m.all_servers_gamemode.AppendText(ctx.Translator.Translate("All gamemodes", nil))
// Get sorted gamemodes keys.
gm_keys := make([]int, 0, len(m.gamemodes))
for i := range m.gamemodes {
@ -582,10 +579,10 @@ func (m *MainWindow) InitializeTabs() {
swin2 := gtk.NewScrolledWindow(nil, nil)
swin2.Add(m.fav_servers)
tab_fav_srv_hbox.PackStart(swin2, true, true, 5)
m.tab_widget.AppendPage(tab_fav_srv_hbox, gtk.NewLabel("Favorites"))
m.tab_widget.AppendPage(tab_fav_srv_hbox, gtk.NewLabel(ctx.Translator.Translate("Favorites", nil)))
m.fav_servers.SetModel(m.fav_servers_store)
m.fav_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Status", gtk.NewCellRendererPixbuf(), "pixbuf", 0))
m.fav_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Public", gtk.NewCellRendererPixbuf(), "pixbuf", 1))
m.fav_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Status", nil), gtk.NewCellRendererPixbuf(), "pixbuf", 0))
m.fav_servers.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Public", nil), gtk.NewCellRendererPixbuf(), "pixbuf", 1))
// +2 because we have 2 static columns.
fav_servers_columns_to_append := make([]*gtk.TreeViewColumn, len(m.column_names) + 2)
@ -593,19 +590,19 @@ func (m *MainWindow) InitializeTabs() {
// Check if we have column position saved. If so - use it.
// Otherwise use default position.
// Should be actual only for first launch.
position := ctx.Cfg.Cfg["/mainwindow/fav_servers/" + name + "_position"]
position := ctx.Cfg.Cfg["/mainwindow/fav_servers/" + ctx.Translator.Translate(name, nil) + "_position"]
if len(position) == 0 {
position = pos
}
position_int, _ := strconv.Atoi(position)
// Same for width.
width := ctx.Cfg.Cfg["/mainwindow/fav_servers/" + name + "_width"]
width := ctx.Cfg.Cfg["/mainwindow/fav_servers/" + ctx.Translator.Translate(name, nil) + "_width"]
if len(width) == 0 {
width = "-1"
}
width_int, _ := strconv.Atoi(width)
col := gtk.NewTreeViewColumnWithAttributes(name, gtk.NewCellRendererText(), "markup", position_int)
col := gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate(name, nil), gtk.NewCellRendererText(), "markup", position_int)
// For some reason this cause panic on Windows, so disabling
// default sorting here.
if runtime.GOOS != "windows" {
@ -629,6 +626,11 @@ func (m *MainWindow) InitializeTabs() {
m.fav_servers.AppendColumn(fav_servers_columns_to_append[i])
}
// Sorting functions.
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], m.sortServersByName)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing)
// Selection changed signal, which will update server's short info pane.
m.fav_servers.Connect("cursor-changed", m.showShortServerInformation)
@ -637,8 +639,8 @@ func (m *MainWindow) InitializeTabs() {
tab_fav_srv_hbox.PackStart(tab_fav_srv_ctl_vbox, false, true, 5)
// Checkbox for hiding offline servers.
m.fav_servers_hide_offline = gtk.NewCheckButtonWithLabel("Hide offline servers")
m.fav_servers_hide_offline.SetTooltipText("Hide offline servers on Favorites tab")
m.fav_servers_hide_offline = gtk.NewCheckButtonWithLabel(ctx.Translator.Translate("Hide offline servers", nil))
m.fav_servers_hide_offline.SetTooltipText(ctx.Translator.Translate("Hide offline servers on Favorites tab", nil))
tab_fav_srv_ctl_vbox.PackStart(m.fav_servers_hide_offline, false, true, 5)
m.fav_servers_hide_offline.Clicked(m.hideOfflineFavoriteServers)
// Restore value of hide offline servers checkbox.
@ -653,8 +655,8 @@ func (m *MainWindow) InitializeTabs() {
}
// Checkbox for hiding passworded servers.
m.fav_servers_hide_private = gtk.NewCheckButtonWithLabel("Hide private servers")
m.fav_servers_hide_private.SetTooltipText("Hide servers which requires password to enter")
m.fav_servers_hide_private = gtk.NewCheckButtonWithLabel(ctx.Translator.Translate("Hide private servers", nil))
m.fav_servers_hide_private.SetTooltipText(ctx.Translator.Translate("Hide servers which requires password to enter", nil))
tab_fav_srv_ctl_vbox.PackStart(m.fav_servers_hide_private, false, true, 5)
m.fav_servers_hide_private.Clicked(m.hidePrivateFavoriteServers)
// Restore checkbox value.
@ -668,8 +670,8 @@ func (m *MainWindow) InitializeTabs() {
}
m.fav_servers_version = gtk.NewComboBoxText()
m.fav_servers_version.SetTooltipText("Show only servers which uses selected version of Urban Terror")
m.fav_servers_version.AppendText("All versions")
m.fav_servers_version.SetTooltipText(ctx.Translator.Translate("Show only servers which uses selected version of Urban Terror", nil))
m.fav_servers_version.AppendText(ctx.Translator.Translate("All versions", nil))
for i := range common.SUPPORTED_URT_VERSIONS {
m.fav_servers_version.AppendText(common.SUPPORTED_URT_VERSIONS[i])
}
@ -685,8 +687,8 @@ func (m *MainWindow) InitializeTabs() {
// Filtering by gamemode
m.fav_servers_gamemode = gtk.NewComboBoxText()
m.fav_servers_gamemode.SetTooltipText("Show only servers which uses selected game mode")
m.fav_servers_gamemode.AppendText("All gamemodes")
m.fav_servers_gamemode.SetTooltipText(ctx.Translator.Translate("Show only servers which uses selected game mode", nil))
m.fav_servers_gamemode.AppendText(ctx.Translator.Translate("All gamemodes", nil))
// Gamemode keys already sorted while adding same filter to "Servers"
// tab, so just re-use them.
for i := range gm_keys {
@ -752,8 +754,8 @@ func (m *MainWindow) InitializeToolbar() {
button_update_all_servers_icon_pixbuf.SetSize(24, 24)
button_update_all_servers_icon_pixbuf.Write(button_update_all_servers_icon_bytes)
button_update_all_servers_icon := gtk.NewImageFromPixbuf(button_update_all_servers_icon_pixbuf.GetPixbuf())
button_update_all_servers := gtk.NewToolButton(button_update_all_servers_icon, "Update all servers")
button_update_all_servers.SetTooltipText("Update all servers in currently selected tab")
button_update_all_servers := gtk.NewToolButton(button_update_all_servers_icon, ctx.Translator.Translate("Update all servers", nil))
button_update_all_servers.SetTooltipText(ctx.Translator.Translate("Update all servers in currently selected tab", nil))
button_update_all_servers.OnClicked(m.UpdateServers)
m.toolbar.Insert(button_update_all_servers, 0)
@ -762,8 +764,8 @@ func (m *MainWindow) InitializeToolbar() {
button_update_one_server_icon_pixbuf.SetSize(24, 24)
button_update_one_server_icon_pixbuf.Write(button_update_one_server_icon_bytes)
button_update_one_server_icon := gtk.NewImageFromPixbuf(button_update_one_server_icon_pixbuf.GetPixbuf())
button_update_one_server := gtk.NewToolButton(button_update_one_server_icon, "Update selected server")
button_update_one_server.SetTooltipText("Update only selected server")
button_update_one_server := gtk.NewToolButton(button_update_one_server_icon, ctx.Translator.Translate("Update selected server", nil))
button_update_one_server.SetTooltipText(ctx.Translator.Translate("Update only selected server", nil))
button_update_one_server.OnClicked(m.updateOneServer)
m.toolbar.Insert(button_update_one_server, 1)
@ -777,8 +779,8 @@ func (m *MainWindow) InitializeToolbar() {
fav_button_icon_pixbuf.SetSize(24, 24)
fav_button_icon_pixbuf.Write(fav_button_icon_bytes)
fav_button_icon := gtk.NewImageFromPixbuf(fav_button_icon_pixbuf.GetPixbuf())
fav_button := gtk.NewToolButton(fav_button_icon, "Add to favorites")
fav_button.SetTooltipText("Add selected server to favorites")
fav_button := gtk.NewToolButton(fav_button_icon, ctx.Translator.Translate("Add to favorites", nil))
fav_button.SetTooltipText(ctx.Translator.Translate("Add selected server to favorites", nil))
fav_button.OnClicked(m.addToFavorites)
m.toolbar.Insert(fav_button, 3)
@ -787,8 +789,8 @@ func (m *MainWindow) InitializeToolbar() {
fav_edit_button_icon_pixbuf.SetSize(24, 24)
fav_edit_button_icon_pixbuf.Write(fav_edit_button_icon_bytes)
fav_edit_button_icon := gtk.NewImageFromPixbuf(fav_edit_button_icon_pixbuf.GetPixbuf())
fav_edit_button := gtk.NewToolButton(fav_edit_button_icon, "Edit favorite")
fav_edit_button.SetTooltipText("Edit selected favorite server")
fav_edit_button := gtk.NewToolButton(fav_edit_button_icon, ctx.Translator.Translate("Edit favorite", nil))
fav_edit_button.SetTooltipText(ctx.Translator.Translate("Edit selected favorite server", nil))
fav_edit_button.OnClicked(m.editFavorite)
m.toolbar.Insert(fav_edit_button, 4)
@ -798,8 +800,8 @@ func (m *MainWindow) InitializeToolbar() {
fav_delete_button_icon_pixbuf.SetSize(24, 24)
fav_delete_button_icon_pixbuf.Write(fav_delete_button_icon_bytes)
fav_delete_button_icon := gtk.NewImageFromPixbuf(fav_delete_button_icon_pixbuf.GetPixbuf())
fav_delete_button := gtk.NewToolButton(fav_delete_button_icon, "Remove from favorites")
fav_delete_button.SetTooltipText("Remove selected server from favorites")
fav_delete_button := gtk.NewToolButton(fav_delete_button_icon, ctx.Translator.Translate("Remove from favorites", nil))
fav_delete_button.SetTooltipText(ctx.Translator.Translate("Remove selected server from favorites", nil))
fav_delete_button.OnClicked(m.deleteFromFavorites)
m.toolbar.Insert(fav_delete_button, 5)
@ -809,8 +811,8 @@ func (m *MainWindow) InitializeToolbar() {
copy_srv_addr_button_icon_pixbuf.SetSize(24, 24)
copy_srv_addr_button_icon_pixbuf.Write(copy_srv_addr_button_icon_bytes)
copy_srv_addr_button_icon := gtk.NewImageFromPixbuf(copy_srv_addr_button_icon_pixbuf.GetPixbuf())
copy_srv_addr_button := gtk.NewToolButton(copy_srv_addr_button_icon, "Copy server's creds")
copy_srv_addr_button.SetTooltipText("Copy server's credentials to clipboard for sharing")
copy_srv_addr_button := gtk.NewToolButton(copy_srv_addr_button_icon, ctx.Translator.Translate("Copy server's creds", nil))
copy_srv_addr_button.SetTooltipText(ctx.Translator.Translate("Copy server's credentials to clipboard for sharing", nil))
copy_srv_addr_button.OnClicked(m.copyServerCredentialsToClipboard)
m.toolbar.Insert(copy_srv_addr_button, 6)
@ -819,7 +821,7 @@ func (m *MainWindow) InitializeToolbar() {
toolbar_separator_toolitem.SetExpand(true)
m.toolbar.Insert(toolbar_separator_toolitem, 7)
// Toolbar's label.
m.toolbar_label = gtk.NewLabel("URTrator is ready")
m.toolbar_label = gtk.NewLabel(ctx.Translator.Translate("URTrator is ready", nil))
toolbar_label_toolitem := gtk.NewToolItem()
toolbar_label_toolitem.Add(m.toolbar_label)
m.toolbar.Insert(toolbar_label_toolitem, 8)
@ -837,7 +839,7 @@ func (m *MainWindow) initializeTrayIcon() {
m.tray_icon = gtk.NewStatusIconFromPixbuf(logo)
m.tray_icon.SetName("URTrator")
m.tray_icon.SetTitle("URTrator")
m.tray_icon.SetTooltipText("URTrator is ready")
m.tray_icon.SetTooltipText(ctx.Translator.Translate("URTrator is ready", nil))
// Tray menu is still buggy on windows, so skipping initialization,
// if OS is Windows.
@ -845,7 +847,7 @@ func (m *MainWindow) initializeTrayIcon() {
m.tray_menu = gtk.NewMenu()
// Open/Close URTrator menu item.
open_close_item := gtk.NewMenuItemWithLabel("Show / Hide URTrator")
open_close_item := gtk.NewMenuItemWithLabel(ctx.Translator.Translate("Show / Hide URTrator", nil))
open_close_item.Connect("activate", m.showHide)
m.tray_menu.Append(open_close_item)
@ -854,7 +856,7 @@ func (m *MainWindow) initializeTrayIcon() {
m.tray_menu.Append(sep1)
// Exit menu item.
exit_item := gtk.NewMenuItemWithLabel("Exit")
exit_item := gtk.NewMenuItemWithLabel(ctx.Translator.Translate("Exit", nil))
exit_item.Connect("activate", m.window.Destroy)
m.tray_menu.Append(exit_item)

View File

@ -36,7 +36,7 @@ func (m *MainWindow) launchAsUsual() error {
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
sel := m.all_servers.GetSelection()
model := m.all_servers.GetModel()
if strings.Contains(current_tab, "Favorites") {
if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
sel = m.fav_servers.GetSelection()
model = m.fav_servers.GetModel()
}
@ -46,9 +46,9 @@ func (m *MainWindow) launchAsUsual() error {
// Getting server address.
var srv_addr string
srv_address_gval := glib.ValueFromNative(srv_addr)
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
model.GetValue(iter, m.column_pos["Servers"]["IP"], srv_address_gval)
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
model.GetValue(iter, m.column_pos["Favorites"]["IP"], srv_address_gval)
}
srv_address = srv_address_gval.GetString()
@ -56,16 +56,16 @@ func (m *MainWindow) launchAsUsual() error {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "No server selected.\n\nPlease, select a server to continue connecting."
mbox_string := ctx.Translator.Translate("No server selected.\n\nPlease, select a server to continue connecting.", nil)
messagebox := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
messagebox.Response(func() {
messagebox.Destroy()
})
messagebox.Run()
} else {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Select a server we will connect to!</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Select a server we will connect to!", nil) + "</span></markup>"})
}
return errors.New("No server selected.")
return errors.New(ctx.Translator.Translate("No server selected.", nil))
}
server_profile := ctx.Cache.Servers[srv_address].Server
@ -76,7 +76,7 @@ func (m *MainWindow) launchAsUsual() error {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Selected server is offline.\n\nWould you still want to launch Urban Terror?\nIt will just launch a game, without connecting to\nany server."
mbox_string := ctx.Translator.Translate("Selected server is offline.\n\nWould you still want to launch Urban Terror?\nIt will just launch a game, without connecting to\nany server.", nil)
messagebox := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_YES_NO, mbox_string)
messagebox.Connect("response", func(resp *glib.CallbackContext) {
if resp.Args(0) == 4294967287 {
@ -93,14 +93,14 @@ func (m *MainWindow) launchAsUsual() error {
}
if !will_continue {
return errors.New("User declined to connect to offline server")
return errors.New(ctx.Translator.Translate("User declined to connect to offline server", nil))
}
}
// Getting selected profile's name.
profile_name := m.profiles.GetActiveText()
user_profile := &datamodels.Profile{}
if strings.Contains(current_tab, "Servers") {
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
// Checking profile name length. If 0 - then stop executing :)
// This check only relevant to "Servers" tab, favorite servers
// have profiles defined (see next).
@ -108,19 +108,19 @@ func (m *MainWindow) launchAsUsual() error {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Invalid game profile selected.\n\nPlease, select profile and retry."
mbox_string := ctx.Translator.Translate("Invalid game profile selected.\n\nPlease, select profile and retry.", nil)
messagebox := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
messagebox.Response(func() {
messagebox.Destroy()
})
messagebox.Run()
} else {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Invalid game profile selected.</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Invalid game profile selected.", nil) + "</span></markup>"})
}
return errors.New("User didn't select valid profile.")
return errors.New(ctx.Translator.Translate("User didn't select valid profile.", nil))
}
user_profile = ctx.Cache.Profiles[profile_name].Profile
} else if strings.Contains(current_tab, "Favorites") {
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
// For favorite servers profile specified in favorite server
// information have higher priority, so we just override it :)
user_profile_cached, ok := ctx.Cache.Profiles[server_profile.ProfileToUse]
@ -128,16 +128,16 @@ func (m *MainWindow) launchAsUsual() error {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Invalid game profile specified for favorite server.\n\nPlease, edit your favorite server, select valid profile and retry."
mbox_string := ctx.Translator.Translate("Invalid game profile specified for favorite server.\n\nPlease, edit your favorite server, select valid profile and retry.", nil)
messagebox := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
messagebox.Response(func() {
messagebox.Destroy()
})
messagebox.Run()
} else {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Invalid game profile specified in favorite entry.</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Invalid game profile specified in favorite entry.", nil) + "</span></markup>"})
}
return errors.New("User didn't select valid profile.")
return errors.New(ctx.Translator.Translate("User didn't select valid profile.", nil))
}
user_profile = user_profile_cached.Profile
}
@ -191,7 +191,7 @@ func (m *MainWindow) launchActually(server_profile *datamodels.Server, user_prof
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Selected server is offline.\n\nWould you still want to launch Urban Terror?\nIt will just launch a game, without connecting to\nany server."
mbox_string := ctx.Translator.Translate("Selected server is offline.\n\nWould you still want to launch Urban Terror?\nIt will just launch a game, without connecting to\nany server.", nil)
messagebox := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_YES_NO, mbox_string)
messagebox.Connect("response", func(resp *glib.CallbackContext) {
if resp.Args(0) == 4294967287 {
@ -208,7 +208,7 @@ func (m *MainWindow) launchActually(server_profile *datamodels.Server, user_prof
}
if !will_continue {
return errors.New("User declined to connect to offline server")
return errors.New(ctx.Translator.Translate("User declined to connect to offline server", nil))
}
}
@ -217,16 +217,16 @@ func (m *MainWindow) launchActually(server_profile *datamodels.Server, user_prof
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Invalid game profile selected.\n\nSelected profile have different game version than server.\nPlease, select valid profile and retry."
mbox_string := ctx.Translator.Translate("Invalid game profile selected.\n\nSelected profile have different game version than server.\nPlease, select valid profile and retry.", nil)
messagebox := gtk.NewMessageDialog(m.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
messagebox.Response(func() {
messagebox.Destroy()
})
messagebox.Run()
} else {
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Invalid game profile selected.</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Invalid game profile selected.", nil) + "</span></markup>"})
}
return errors.New("User didn't select valid profile, mismatch with server's version.")
return errors.New(ctx.Translator.Translate("User didn't select valid profile, mismatch with server's version.", nil))
}
server_password := password
@ -244,7 +244,7 @@ func (m *MainWindow) launchActually(server_profile *datamodels.Server, user_prof
srv_name_for_label = string([]byte(srv_name)[8:len(srv_name)-9])
}
// Show great coloured label.
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Urban Terror is launched with profile </span><span foreground=\"blue\">" + user_profile.Name + "</span> <span foreground=\"red\" font_weight=\"bold\">and connected to </span><span foreground=\"orange\" font_weight=\"bold\">" + srv_name_for_label + "</span></markup>"})
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("Urban Terror is launched with profile", nil) + " </span><span foreground=\"blue\">" + user_profile.Name + "</span> <span foreground=\"red\" font_weight=\"bold\">" + ctx.Translator.Translate("and connected to", nil) + " </span><span foreground=\"orange\" font_weight=\"bold\">" + srv_name_for_label + "</span></markup>"})
m.launch_button.SetSensitive(false)
// ToDo: handling server passwords.
ctx.Launcher.Launch(server_profile, user_profile, server_password, []string{"+name", nickname_to_use}, m.unlockInterface)

View File

@ -15,12 +15,12 @@ func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b
var name2_raw glib.GValue
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
if current_tab == "Servers" {
model.GetValue(a, m.column_pos["Servers"]["Name"], &name1_raw)
model.GetValue(b, m.column_pos["Servers"]["Name"], &name2_raw)
} else if current_tab == "Favorites" {
model.GetValue(a, m.column_pos["Favorites"]["Name"], &name1_raw)
model.GetValue(b, m.column_pos["Favorites"]["Name"], &name2_raw)
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
model.GetValue(a, m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], &name1_raw)
model.GetValue(b, m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], &name2_raw)
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
model.GetValue(a, m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], &name1_raw)
model.GetValue(b, m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], &name2_raw)
} else {
return 0
}
@ -42,12 +42,12 @@ func (m *MainWindow) sortServersByPlayers(model *gtk.TreeModel, a *gtk.TreeIter,
var players2_raw glib.GValue
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
if current_tab == "Servers" {
model.GetValue(a, m.column_pos["Servers"]["Players"], &players1_raw)
model.GetValue(b, m.column_pos["Servers"]["Players"], &players2_raw)
} else if current_tab == "Favorites" {
model.GetValue(a, m.column_pos["Favorites"]["Players"], &players1_raw)
model.GetValue(b, m.column_pos["Favorites"]["Players"], &players2_raw)
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
model.GetValue(a, m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], &players1_raw)
model.GetValue(b, m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], &players2_raw)
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
model.GetValue(a, m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], &players1_raw)
model.GetValue(b, m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], &players2_raw)
} else {
return 0
}
@ -73,12 +73,12 @@ func (m *MainWindow) sortServersByPing(model *gtk.TreeModel, a *gtk.TreeIter, b
var ping2_raw glib.GValue
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
if current_tab == "Servers" {
model.GetValue(a, m.column_pos["Servers"]["Ping"], &ping1_raw)
model.GetValue(b, m.column_pos["Servers"]["Ping"], &ping2_raw)
} else if current_tab == "Favorites" {
model.GetValue(a, m.column_pos["Favorites"]["Ping"], &ping1_raw)
model.GetValue(b, m.column_pos["Favorites"]["Ping"], &ping2_raw)
if strings.Contains(current_tab, ctx.Translator.Translate("Servers", nil)) {
model.GetValue(a, m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], &ping1_raw)
model.GetValue(b, m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], &ping2_raw)
} else if strings.Contains(current_tab, ctx.Translator.Translate("Favorites", nil)) {
model.GetValue(a, m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], &ping1_raw)
model.GetValue(b, m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], &ping2_raw)
} else {
return 0
}

View File

@ -77,7 +77,7 @@ func (o *OptionsDialog) closeOptionsDialogWithSaving() {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Some options require application restart to be applied."
mbox_string := ctx.Translator.Translate("Some options require application restart to be applied.", nil)
m := gtk.NewMessageDialog(o.window, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -167,10 +167,10 @@ func (o *OptionsDialog) fill() {
func (o *OptionsDialog) initializeAppearanceTab() {
appearance_vbox := gtk.NewVBox(false, 0)
l := gtk.NewLabel("There will be some appearance configuration options soon.")
l := gtk.NewLabel(ctx.Translator.Translate("There will be some appearance configuration options soon.", nil))
appearance_vbox.PackStart(l, false, true, 5)
o.tab_widget.AppendPage(appearance_vbox, gtk.NewLabel("Appearance"))
o.tab_widget.AppendPage(appearance_vbox, gtk.NewLabel(ctx.Translator.Translate("Appearance", nil)))
}
func (o *OptionsDialog) initializeGeneralTab() {
@ -179,17 +179,17 @@ func (o *OptionsDialog) initializeGeneralTab() {
general_table := gtk.NewTable(2, 2, false)
// Tray icon checkbox.
show_tray_icon_label := gtk.NewLabel("Show icon in tray")
show_tray_icon_label := gtk.NewLabel(ctx.Translator.Translate("Show icon in tray", nil))
show_tray_icon_label.SetAlignment(0, 0)
general_table.Attach(show_tray_icon_label, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK, 5, 5)
o.show_tray_icon = gtk.NewCheckButtonWithLabel("")
o.show_tray_icon.SetTooltipText("Show icon in tray")
o.show_tray_icon.SetTooltipText(ctx.Translator.Translate("Show icon in tray", nil))
general_table.Attach(o.show_tray_icon, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
// Autoupdate checkbox.
autoupdate_tooltip := "Should URTrator check for updates and update itself? Not working now."
autoupdate_label := gtk.NewLabel("Automatically update URTrator?")
autoupdate_tooltip := ctx.Translator.Translate("Should URTrator check for updates and update itself? Not working now.", nil)
autoupdate_label := gtk.NewLabel(ctx.Translator.Translate("Automatically update URTrator?", nil))
autoupdate_label.SetTooltipText(autoupdate_tooltip)
autoupdate_label.SetAlignment(0, 0)
general_table.Attach(autoupdate_label, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
@ -204,7 +204,7 @@ func (o *OptionsDialog) initializeGeneralTab() {
general_vbox.PackStart(general_table, false, true, 0)
general_vbox.PackStart(sep, false, true, 0)
o.tab_widget.AppendPage(general_vbox, gtk.NewLabel("General"))
o.tab_widget.AppendPage(general_vbox, gtk.NewLabel(ctx.Translator.Translate("General", nil)))
}
func (o *OptionsDialog) initializeServersOptionsTab() {
@ -214,8 +214,8 @@ func (o *OptionsDialog) initializeServersOptionsTab() {
servers_updating_table.SetRowSpacings(2)
// Master server address.
master_server_addr_tooltip := "Address of master server. Specify in form: addr:port."
master_server_addr_label := gtk.NewLabel("Master server address")
master_server_addr_tooltip := ctx.Translator.Translate("Address of master server. Specify in form: addr:port.", nil)
master_server_addr_label := gtk.NewLabel(ctx.Translator.Translate("Master server address", nil))
master_server_addr_label.SetTooltipText(master_server_addr_tooltip)
master_server_addr_label.SetAlignment(0, 0)
servers_updating_table.Attach(master_server_addr_label, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK, 5, 5)
@ -225,8 +225,8 @@ func (o *OptionsDialog) initializeServersOptionsTab() {
servers_updating_table.Attach(o.master_server_addr, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
// Servers autoupdate checkbox.
servers_autoupdate_cb_tooptip := "Should servers be automatically updated?"
servers_autoupdate_cb_label := gtk.NewLabel("Servers autoupdate")
servers_autoupdate_cb_tooptip := ctx.Translator.Translate("Should servers be automatically updated?", nil)
servers_autoupdate_cb_label := gtk.NewLabel(ctx.Translator.Translate("Servers autoupdate", nil))
servers_autoupdate_cb_label.SetTooltipText(servers_autoupdate_cb_tooptip)
servers_autoupdate_cb_label.SetAlignment(0, 0)
servers_updating_table.Attach(servers_autoupdate_cb_label, 0, 1 ,1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
@ -236,8 +236,8 @@ func (o *OptionsDialog) initializeServersOptionsTab() {
servers_updating_table.Attach(o.servers_autoupdate, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
// Servers update timeout.
servers_autoupdate_timeout_tooltip := "Timeout which will trigger servers information update, in minutes."
servers_autoupdate_label := gtk.NewLabel("Servers update timeout (minutes)")
servers_autoupdate_timeout_tooltip := ctx.Translator.Translate("Timeout which will trigger servers information update, in minutes.", nil)
servers_autoupdate_label := gtk.NewLabel(ctx.Translator.Translate("Servers update timeout (minutes)", nil))
servers_autoupdate_label.SetTooltipText(servers_autoupdate_timeout_tooltip)
servers_autoupdate_label.SetAlignment(0, 0)
servers_updating_table.Attach(servers_autoupdate_label, 0, 1, 2, 3, gtk.FILL, gtk.SHRINK, 5, 5)
@ -252,7 +252,7 @@ func (o *OptionsDialog) initializeServersOptionsTab() {
servers_options_vbox.PackStart(servers_updating_table, false, true, 0)
servers_options_vbox.PackStart(sep, true, true, 0)
o.tab_widget.AppendPage(servers_options_vbox, gtk.NewLabel("Servers updating"))
o.tab_widget.AppendPage(servers_options_vbox, gtk.NewLabel(ctx.Translator.Translate("Servers updating", nil)))
}
func (o *OptionsDialog) initializeStorages() {
@ -275,10 +275,10 @@ func (o *OptionsDialog) initializeTabs() {
buttons_hbox := gtk.NewHBox(false, 0)
sep := gtk.NewHBox(false, 0)
cancel_button := gtk.NewButtonWithLabel("Cancel")
cancel_button := gtk.NewButtonWithLabel(ctx.Translator.Translate("Cancel", nil))
cancel_button.Clicked(o.closeOptionsDialogByCancel)
ok_button := gtk.NewButtonWithLabel("OK")
ok_button := gtk.NewButtonWithLabel(ctx.Translator.Translate("OK", nil))
ok_button.Clicked(o.closeOptionsDialogWithSaving)
buttons_hbox.PackStart(sep, true, true, 5)
@ -296,22 +296,22 @@ func (o *OptionsDialog) initializeUrtTab() {
// Profiles list.
o.profiles_list = gtk.NewTreeView()
o.profiles_list.SetTooltipText("All available profiles")
o.profiles_list.SetTooltipText(ctx.Translator.Translate("All available profiles", nil))
urt_hbox.Add(o.profiles_list)
o.profiles_list.SetModel(o.profiles_list_store)
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Profile name", gtk.NewCellRendererText(), "text", 0))
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Urban Terror version", gtk.NewCellRendererText(), "text", 1))
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Profile name", nil), gtk.NewCellRendererText(), "text", 0))
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Urban Terror version", nil), gtk.NewCellRendererText(), "text", 1))
// Profiles list buttons.
urt_profiles_buttons_vbox := gtk.NewVBox(false, 0)
button_add := gtk.NewButtonWithLabel("Add")
button_add.SetTooltipText("Add new profile")
button_add := gtk.NewButtonWithLabel(ctx.Translator.Translate("Add", nil))
button_add.SetTooltipText(ctx.Translator.Translate("Add new profile", nil))
button_add.Clicked(o.addProfile)
urt_profiles_buttons_vbox.PackStart(button_add, false, true, 0)
button_edit := gtk.NewButtonWithLabel("Edit")
button_edit.SetTooltipText("Edit selected profile. Do nothing if no profile was selected.")
button_edit := gtk.NewButtonWithLabel(ctx.Translator.Translate("Edit", nil))
button_edit.SetTooltipText(ctx.Translator.Translate("Edit selected profile. Do nothing if no profile was selected.", nil))
button_edit.Clicked(o.editProfile)
urt_profiles_buttons_vbox.PackStart(button_edit, false, true, 5)
@ -319,14 +319,14 @@ func (o *OptionsDialog) initializeUrtTab() {
sep := gtk.NewVBox(false, 0)
urt_profiles_buttons_vbox.PackStart(sep, true, true, 5)
button_delete := gtk.NewButtonWithLabel("Delete")
button_delete.SetTooltipText("Delete selected profile. Do nothing if no profile was selected.")
button_delete := gtk.NewButtonWithLabel(ctx.Translator.Translate("Delete", nil))
button_delete.SetTooltipText(ctx.Translator.Translate("Delete selected profile. Do nothing if no profile was selected.", nil))
button_delete.Clicked(o.deleteProfile)
urt_profiles_buttons_vbox.PackStart(button_delete, false, true, 0)
urt_hbox.Add(urt_profiles_buttons_vbox)
o.tab_widget.AppendPage(urt_hbox, gtk.NewLabel("Urban Terror"))
o.tab_widget.AppendPage(urt_hbox, gtk.NewLabel(ctx.Translator.Translate("Urban Terror", nil)))
// Load Profiles.
ctx.Eventer.LaunchEvent("loadProfilesIntoOptionsWindow", map[string]string{})
@ -383,7 +383,7 @@ func (o *OptionsDialog) saveGeneral() {
func (o *OptionsDialog) ShowOptionsDialog() {
o.window = gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
o.window.SetTitle("URTrator - Options")
o.window.SetTitle(ctx.Translator.Translate("URTrator - Options", nil))
o.window.Connect("destroy", o.closeOptionsDialogWithDiscard)
o.window.SetModal(true)
o.window.SetSizeRequest(550, 400)

View File

@ -53,7 +53,7 @@ type OptionsProfile struct {
}
func (op *OptionsProfile) browseForBinary() {
op.f = gtk.NewFileChooserDialog("URTrator - Select Urban Terror binary", op.window, gtk.FILE_CHOOSER_ACTION_OPEN, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)
op.f = gtk.NewFileChooserDialog(ctx.Translator.Translate("URTrator - Select Urban Terror binary", nil), op.window, gtk.FILE_CHOOSER_ACTION_OPEN, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)
op.f.Response(op.browseForBinaryHelper)
op.f.Run()
}
@ -74,7 +74,7 @@ func (op *OptionsProfile) browseForBinaryHelper() {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Invalid binary selected!\nAccording to your OS, it should be Quake3-UrT.x86_64."
mbox_string := ctx.Translator.Translate("Invalid binary selected!\nAccording to your OS, it should be", nil) + " Quake3-UrT.x86_64."
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -96,7 +96,7 @@ func (op *OptionsProfile) browseForBinaryHelper() {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Invalid binary selected!\nAccording to your OS, it should be Quake3-UrT.app/Contents/MacOS/Quake3-UrT.x86_64."
mbox_string := ctx.Translator.Translate("Invalid binary selected!\nAccording to your OS, it should be", nil) + " Quake3-UrT.app/Contents/MacOS/Quake3-UrT.x86_64."
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -111,7 +111,7 @@ func (op *OptionsProfile) browseForBinaryHelper() {
// Temporary disable all these modals on Linux.
// See https://github.com/mattn/go-gtk/issues/289.
if runtime.GOOS != "linux" {
mbox_string := "Invalid binary selected!\nAccording to your OS, it should be Quake3-UrT.app/Contents/MacOS/Quake3-UrT.x86_64.\n\nNote, that currently URTrator supports only official binary."
mbox_string := ctx.Translator.Translate("Invalid binary selected!\nAccording to your OS, it should be", nil) + " Quake3-UrT.app/Contents/MacOS/Quake3-UrT.x86_64.\n\n" + ctx.Translator.Translate("Note, that currently URTrator supports only official binary.", nil)
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -138,9 +138,9 @@ func (op *OptionsProfile) Initialize(update bool) {
op.window = gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
if update {
op.window.SetTitle("URTrator - Update Urban Terror profile")
op.window.SetTitle(ctx.Translator.Translate("URTrator - Update Urban Terror profile", nil))
} else {
op.window.SetTitle("URTrator - Add Urban Terror profile")
op.window.SetTitle(ctx.Translator.Translate("URTrator - Add Urban Terror profile", nil))
}
op.window.Connect("destroy", op.closeWithDiscard)
op.window.SetModal(true)
@ -152,8 +152,8 @@ func (op *OptionsProfile) Initialize(update bool) {
op.table.SetRowSpacings(2)
// Profile name.
profile_name_tooltip := "This how you will see profile on profiles lists."
pn_label := gtk.NewLabel("Profile name:")
profile_name_tooltip := ctx.Translator.Translate("This how you will see profile on profiles lists.", nil)
pn_label := gtk.NewLabel(ctx.Translator.Translate("Profile name:", nil))
pn_label.SetTooltipText(profile_name_tooltip)
pn_label.SetAlignment(0, 0)
op.table.Attach(pn_label, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK, 5, 5)
@ -164,8 +164,8 @@ func (op *OptionsProfile) Initialize(update bool) {
// Urban Terror version.
urt_version_tooltip := "Urban Terror version for which this profile applies."
urt_version_label := gtk.NewLabel("Urban Terror version:")
urt_version_tooltip := ctx.Translator.Translate("Urban Terror version for which this profile applies.", nil)
urt_version_label := gtk.NewLabel(ctx.Translator.Translate("Urban Terror version:", nil))
urt_version_label.SetTooltipText(urt_version_tooltip)
urt_version_label.SetAlignment(0, 0)
op.table.Attach(urt_version_label, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
@ -179,16 +179,16 @@ func (op *OptionsProfile) Initialize(update bool) {
op.table.Attach(op.urt_version_combo, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
// Urban Terror binary path.
select_binary_tooltip := "Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\n\nQuake3-UrT.i386 for linux-x86\nQuake3-UrT.x86_64 for linux-amd64\nQuake3-UrT.app for macOS"
select_binary_tooltip := ctx.Translator.Translate("Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\n\nQuake3-UrT.i386 for linux-x86\nQuake3-UrT.x86_64 for linux-amd64\nQuake3-UrT.app for macOS", nil)
binpath_hbox := gtk.NewHBox(false, 0)
binpath_label := gtk.NewLabel("Urban Terror binary:")
binpath_label := gtk.NewLabel(ctx.Translator.Translate("Urban Terror binary:", nil))
binpath_label.SetTooltipText(select_binary_tooltip)
binpath_label.SetAlignment(0, 0)
op.table.Attach(binpath_label, 0, 1, 2, 3, gtk.FILL, gtk.SHRINK, 5, 5)
op.binary_path = gtk.NewEntry()
op.binary_path.SetTooltipText(select_binary_tooltip)
button_select_binary := gtk.NewButtonWithLabel("Browse")
button_select_binary := gtk.NewButtonWithLabel(ctx.Translator.Translate("Browse", nil))
button_select_binary.SetTooltipText(select_binary_tooltip)
button_select_binary.Clicked(op.browseForBinary)
binpath_hbox.PackStart(op.binary_path, true, true, 5)
@ -196,8 +196,8 @@ func (op *OptionsProfile) Initialize(update bool) {
op.table.Attach(binpath_hbox, 1, 2, 2, 3, gtk.FILL, gtk.FILL, 0, 0)
// Should we use additional X session?
another_x_tooltip := "If this is checked, Urban Terror will be launched in another X session.\n\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin."
another_x_label := gtk.NewLabel("Start Urban Terror in another X session?")
another_x_tooltip := ctx.Translator.Translate("If this is checked, Urban Terror will be launched in another X session.\n\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin.", nil)
another_x_label := gtk.NewLabel(ctx.Translator.Translate("Start Urban Terror in another X session?", nil))
another_x_label.SetTooltipText(another_x_tooltip)
another_x_label.SetAlignment(0, 0)
op.table.Attach(another_x_label, 0, 1, 3, 4, gtk.FILL, gtk.SHRINK, 5, 5)
@ -210,8 +210,8 @@ func (op *OptionsProfile) Initialize(update bool) {
op.table.Attach(op.another_x_session, 1, 2, 3, 4, gtk.FILL, gtk.FILL, 5, 5)
// Additional game parameters.
params_tooltip := "Additional parameters that will be passed to Urban Terror executable."
params_label := gtk.NewLabel("Additional parameters:")
params_tooltip := ctx.Translator.Translate("Additional parameters that will be passed to Urban Terror executable.", nil)
params_label := gtk.NewLabel(ctx.Translator.Translate("Additional parameters:", nil))
params_label.SetTooltipText(params_tooltip)
params_label.SetAlignment(0, 0)
op.table.Attach(params_label, 0, 1, 4, 5, gtk.FILL, gtk.SHRINK, 5, 5)
@ -228,8 +228,8 @@ func (op *OptionsProfile) Initialize(update bool) {
buttons_box := gtk.NewHBox(false, 0)
buttons_sep := gtk.NewHBox(false, 0)
cancel_button := gtk.NewButtonWithLabel("Cancel")
cancel_button.SetTooltipText("Close without saving")
cancel_button := gtk.NewButtonWithLabel(ctx.Translator.Translate("Cancel", nil))
cancel_button.SetTooltipText(ctx.Translator.Translate("Close without saving", nil))
cancel_button.Clicked(op.closeByCancel)
buttons_box.PackStart(cancel_button, false, true, 5)
@ -237,11 +237,11 @@ func (op *OptionsProfile) Initialize(update bool) {
add_button := gtk.NewButton()
if op.update {
add_button.SetLabel("Update")
add_button.SetTooltipText("Update profile")
add_button.SetLabel(ctx.Translator.Translate("Update", nil))
add_button.SetTooltipText(ctx.Translator.Translate("Update profile", nil))
} else {
add_button.SetLabel("Add")
add_button.SetTooltipText("Add profile")
add_button.SetLabel(ctx.Translator.Translate("Add", nil))
add_button.SetTooltipText(ctx.Translator.Translate("Add profile", nil))
}
add_button.Clicked(op.saveProfile)
buttons_box.PackStart(add_button, false, true, 5)
@ -288,7 +288,7 @@ func (op *OptionsProfile) saveProfile() {
// Validating fields.
// Profile name must not be empty.
if len(op.profile_name.GetText()) < 1 {
mbox_string := "Empty profile name!\nProfile must be named somehow."
mbox_string := ctx.Translator.Translate("Empty profile name!\nProfile must be named somehow.", nil)
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -297,7 +297,7 @@ func (op *OptionsProfile) saveProfile() {
}
// Binary path must also be filled.
if len(op.binary_path.GetText()) < 1 {
mbox_string := "Empty path to binary!\nThis profile will be unusable if you\nwill not provide path to binary!"
mbox_string := ctx.Translator.Translate("Empty path to binary!\nThis profile will be unusable if you\nwill not provide path to binary!", nil)
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -307,7 +307,7 @@ func (op *OptionsProfile) saveProfile() {
// ...and must be executable! :)
_, err := os.Stat(op.binary_path.GetText())
if err != nil {
mbox_string := "Invalid path to binary!\n\nError was:\n" + err.Error() + "\n\nCheck binary path and try again."
mbox_string := ctx.Translator.Translate("Invalid path to binary!\n\nError was:\n", nil) + err.Error() + ctx.Translator.Translate("\n\nCheck binary path and try again.", nil)
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()
@ -320,7 +320,7 @@ func (op *OptionsProfile) saveProfile() {
_, ok := ctx.Cache.Profiles[profile_name]
if ok && !op.update {
mbox_string := "Game profile with same name already exist.\nRename profile for saving."
mbox_string := ctx.Translator.Translate("Game profile with same name already exist.\nRename profile for saving.", nil)
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
m.Response(func() {
m.Destroy()

View File

@ -63,7 +63,7 @@ func (scd *ServerCVarsDialog) Initialize(w *gtk.Window, srv_address string) {
scd.initializeStorages()
scd.window = gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
scd.window.SetTitle("URTrator - Server CVars")
scd.window.SetTitle(ctx.Translator.Translate("URTrator - Server CVars", nil))
scd.window.Connect("destroy", scd.Close)
scd.window.SetTransientFor(w)
scd.window.SetDefaultSize(300, 400)
@ -80,8 +80,8 @@ func (scd *ServerCVarsDialog) Initialize(w *gtk.Window, srv_address string) {
scd.treeview.SetModel(scd.treeview_store)
si.Add(scd.treeview)
scd.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Key", gtk.NewCellRendererText(), "markup", 0))
scd.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Value", gtk.NewCellRendererText(), "markup", 1))
scd.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Key", nil), gtk.NewCellRendererText(), "markup", 0))
scd.treeview.AppendColumn(gtk.NewTreeViewColumnWithAttributes(ctx.Translator.Translate("Value", nil), gtk.NewCellRendererText(), "markup", 1))
// Close button.
hbox := gtk.NewHBox(false, 0)
@ -90,7 +90,7 @@ func (scd *ServerCVarsDialog) Initialize(w *gtk.Window, srv_address string) {
sep := gtk.NewHBox(false, 0)
hbox.PackStart(sep, true, true, 5)
close_button := gtk.NewButtonWithLabel("Close")
close_button := gtk.NewButtonWithLabel(ctx.Translator.Translate("Close", nil))
close_button.Clicked(scd.Close)
hbox.PackStart(close_button, false, true, 5)