URTrator now can be translated.
This commit is contained in:
parent
9821eb28fd
commit
65f6bd8b4d
@ -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,
|
||||
|
@ -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()
|
||||
|
148
translations/empty/strings.json
Normal file
148
translations/empty/strings.json
Normal 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": ""
|
||||
}
|
148
translations/en_US/strings.json
Normal file
148
translations/en_US/strings.json
Normal 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"
|
||||
}
|
148
translations/ru_RU/strings.json
Normal file
148
translations/ru_RU/strings.json
Normal 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
87
translations_update.py
Executable 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
15
translator/exported.go
Normal 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
127
translator/translator.go
Normal 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
|
||||
}
|
90
translator/translator_unix.go
Normal file
90
translator/translator_unix.go
Normal 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
|
||||
}
|
43
translator/translator_windows.go
Normal file
43
translator/translator_windows.go
Normal 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
|
||||
}
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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") {
|
||||