diff options
author | Ruben Pollan <meskio@sindominio.net> | 2018-03-24 00:05:39 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2018-03-27 22:32:25 +0200 |
commit | dfef7e3acae8e0ccac523bf6a4e70f9b7e6e67a4 (patch) | |
tree | c9e3e98f7d9e1d8ac2e9012ae9b15e9dcc58e6a7 | |
parent | dd2903c45eebfcefae1c535c288396e120292dc8 (diff) |
[i18n] simplify i18n strings
Let's make the application name configurable.
-rw-r--r-- | locales/en-US/messages.gotext.json | 179 | ||||
-rw-r--r-- | locales/es-ES/messages.gotext.json | 161 | ||||
-rw-r--r-- | locales/pt-BR/messages.gotext.json | 161 | ||||
-rw-r--r-- | main.go | 3 | ||||
-rw-r--r-- | systray.go | 45 |
5 files changed, 301 insertions, 248 deletions
diff --git a/locales/en-US/messages.gotext.json b/locales/en-US/messages.gotext.json index bb021cf..2f960cd 100644 --- a/locales/en-US/messages.gotext.json +++ b/locales/en-US/messages.gotext.json @@ -46,29 +46,31 @@ "translation": "Turn on" }, { - "id": "Turn RiseupVPN on", - "message": "Turn RiseupVPN on", - "translation": "Turn RiseupVPN on" - }, - { "id": "Turn off", "message": "Turn off", "translation": "Turn off" }, { - "id": "Turn RiseupVPN off", - "message": "Turn RiseupVPN off", - "translation": "Turn RiseupVPN off" - }, - { "id": "Cancel", "message": "Cancel", "translation": "Cancel" }, { - "id": "Cancel connection to RiseupVPN", - "message": "Cancel connection to RiseupVPN", - "translation": "Cancel connection to RiseupVPN" + "id": "Cancel connection to {ApplicationName}", + "message": "Cancel connection to {ApplicationName}", + "translation": "Cancel connection to {ApplicationName}", + "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ], + "fuzzy": true }, { "id": "Help ...", @@ -78,12 +80,7 @@ { "id": "Donate ...", "message": "Donate ...", - "translation": "Donate ...!!!!" - }, - { - "id": "About ...", - "message": "About ...", - "translation": "About ..." + "translation": "Donate ..." }, { "id": "Quit", @@ -91,84 +88,101 @@ "translation": "Quit" }, { - "id": "Quit BitmaskVPN", - "message": "Quit BitmaskVPN", - "translation": "Quit BitmaskVPN" - }, - { "id": "Route traffic through", "message": "Route traffic through", "translation": "Route traffic through" }, { - "id": "Use RiseupVPN {Name} gateway", - "message": "Use RiseupVPN {Name} gateway", - "translation": "Use RiseupVPN {Name} gateway", + "id": "Use {ApplicationName} {City} gateway", + "message": "Use {ApplicationName} {City} gateway", + "translation": "Use {ApplicationName} {City} gateway", + "translatorComment": "Copied from source.", "placeholders": [ { - "id": "Name", - "string": "%[1]v", + "id": "ApplicationName", + "string": "%[1]s", "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "name" + "expr": "applicationName" + }, + { + "id": "City", + "string": "%[2]v", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "city" } - ] - }, - { - "id": "RiseupVPN is on", - "message": "RiseupVPN is on", - "translation": "RiseupVPN is on", - "translatorComment": "Copied from source.", - "fuzzy": true - }, - { - "id": "VPN is on", - "message": "VPN is on", - "translation": "VPN is on", - "translatorComment": "Copied from source.", - "fuzzy": true - }, - { - "id": "RiseupVPN is off", - "message": "RiseupVPN is off", - "translation": "RiseupVPN is off", - "translatorComment": "Copied from source.", - "fuzzy": true - }, - { - "id": "VPN is off", - "message": "VPN is off", - "translation": "VPN is off", - "translatorComment": "Copied from source.", + ], "fuzzy": true }, { - "id": "RiseupVPN is starting", - "message": "RiseupVPN is starting", - "translation": "RiseupVPN is starting", + "id": "{ApplicationName} on", + "message": "{ApplicationName} on", + "translation": "{ApplicationName} on", "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ], "fuzzy": true }, { - "id": "VPN is starting", - "message": "VPN is starting", - "translation": "VPN is starting", + "id": "{ApplicationName} off", + "message": "{ApplicationName} off", + "translation": "{ApplicationName} off", "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ], "fuzzy": true }, { - "id": "RiseupVPN is stopping", - "message": "RiseupVPN is stopping", - "translation": "RiseupVPN is stopping", + "id": "Connecting to {ApplicationName}", + "message": "Connecting to {ApplicationName}", + "translation": "Connecting to {ApplicationName}", "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ], "fuzzy": true }, { - "id": "VPN is stopping", - "message": "VPN is stopping", - "translation": "VPN is stopping", + "id": "Stopping {ApplicationName}", + "message": "Stopping {ApplicationName}", + "translation": "Stopping {ApplicationName}", "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ], "fuzzy": true }, { @@ -177,18 +191,21 @@ "translation": "Retry" }, { - "id": "RiseupVPN is blocking internet", - "message": "RiseupVPN is blocking internet", - "translation": "RiseupVPN is blocking internet", - "translatorComment": "Copied from source.", - "fuzzy": true - }, - { - "id": "VPN is blocking internet", - "message": "VPN is blocking internet", - "translation": "VPN is blocking internet", + "id": "{ApplicationName} blocking internet", + "message": "{ApplicationName} blocking internet", + "translation": "{ApplicationName} blocking internet", "translatorComment": "Copied from source.", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ], "fuzzy": true } ] -} +}
\ No newline at end of file diff --git a/locales/es-ES/messages.gotext.json b/locales/es-ES/messages.gotext.json index a140b78..bf16d01 100644 --- a/locales/es-ES/messages.gotext.json +++ b/locales/es-ES/messages.gotext.json @@ -38,29 +38,29 @@ "translation": "Encender" }, { - "id": "Turn RiseupVPN on", - "message": "Turn RiseupVPN on", - "translation": "Enciende RiseupVPN" - }, - { "id": "Turn off", "message": "Turn off", "translation": "Apagar" }, { - "id": "Turn RiseupVPN off", - "message": "Turn RiseupVPN off", - "translation": "Apaga RiseupVPN" - }, - { "id": "Cancel", "message": "Cancel", "translation": "Cancelar" }, { - "id": "Cancel connection to RiseupVPN", - "message": "Cancel connection to RiseupVPN", - "translation": "Cancela la conexión a RiseupVPN" + "id": "Cancel connection to {ApplicationName}", + "message": "Cancel connection to {ApplicationName}", + "translation": "Cancela la conexión a {ApplicationName}", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { "id": "Help ...", @@ -73,79 +73,97 @@ "translation": "Dona ..." }, { - "id": "About ...", - "message": "About ...", - "translation": "Acerca de ..." - }, - { "id": "Quit", "message": "Quit", "translation": "Cerrar" }, { - "id": "Quit BitmaskVPN", - "message": "Quit BitmaskVPN", - "translation": "Cerrar BitmaskVPN" - }, - { "id": "Route traffic through", "message": "Route traffic through", "translation": "Salir a través de" }, { - "id": "Use RiseupVPN {Name} gateway", - "message": "Use RiseupVPN {Name} gateway", - "translation": "Usa la salida de RiseupVPN por {Name}", + "id": "Use {ApplicationName} {City} gateway", + "message": "Use {ApplicationName} {City} gateway", + "translation": "Usa la salida de {ApplicationName} por {City}", "placeholders": [ { - "id": "Name", - "string": "%[1]v", + "id": "ApplicationName", + "string": "%[1]s", "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "name" + "expr": "applicationName" + }, + { + "id": "City", + "string": "%[2]v", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "city" } ] }, { - "id": "RiseupVPN is on", - "message": "RiseupVPN is on", - "translation": "RiseupVPN esta encendida" - }, - { - "id": "VPN is on", - "message": "VPN is on", - "translation": "VPN encendida" - }, - { - "id": "RiseupVPN is off", - "message": "RiseupVPN is off", - "translation": "RiseupVPN esta apagada" - }, - { - "id": "VPN is off", - "message": "VPN is off", - "translation": "VPN apagada" - }, - { - "id": "RiseupVPN is starting", - "message": "RiseupVPN is starting", - "translation": "RiseupVPN esta arrancando" + "id": "{ApplicationName} on", + "message": "{ApplicationName} on", + "translation": "{ApplicationName} encendida", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { - "id": "VPN is starting", - "message": "VPN is starting", - "translation": "VPN arrancando" + "id": "{ApplicationName} off", + "message": "{ApplicationName} off", + "translation": "{ApplicationName} apagada", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { - "id": "RiseupVPN is stopping", - "message": "RiseupVPN is stopping", - "translation": "RiseupVPN esta apagando" + "id": "Connecting to {ApplicationName}", + "message": "Connecting to {ApplicationName}", + "translation": "Connectando a {ApplicationName}", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { - "id": "VPN is stopping", - "message": "VPN is stopping", - "translation": "VPN apagando" + "id": "Stopping {ApplicationName}", + "message": "Stopping {ApplicationName}", + "translation": "Desconnectando de {ApplicationName}", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { "id": "Retry", @@ -153,14 +171,19 @@ "translation": "Reintentar" }, { - "id": "RiseupVPN is blocking internet", - "message": "RiseupVPN is blocking internet", - "translation": "RiseupVPN esta bloqueando internet" - }, - { - "id": "VPN is blocking internet", - "message": "VPN is blocking internet", - "translation": "VPN bloqueando internet" + "id": "{ApplicationName} blocking internet", + "message": "{ApplicationName} blocking internet", + "translation": "{ApplicationName} bloqueando internet", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] } ] } diff --git a/locales/pt-BR/messages.gotext.json b/locales/pt-BR/messages.gotext.json index 460ef73..5ff8d9e 100644 --- a/locales/pt-BR/messages.gotext.json +++ b/locales/pt-BR/messages.gotext.json @@ -38,29 +38,29 @@ "translation": "Ligar" }, { - "id": "Turn RiseupVPN on", - "message": "Turn RiseupVPN on", - "translation": "Ligar a RiseupVPN" - }, - { "id": "Turn off", "message": "Turn off", "translation": "Desligar" }, { - "id": "Turn RiseupVPN off", - "message": "Turn RiseupVPN off", - "translation": "Desligar a RiseupVPN" - }, - { "id": "Cancel", "message": "Cancel", "translation": "Cancelar" }, { - "id": "Cancel connection to RiseupVPN", - "message": "Cancel connection to RiseupVPN", - "translation": "Cancelar a conexão à RiseupVPN" + "id": "Cancel connection to {ApplicationName}", + "message": "Cancel connection to {ApplicationName}", + "translation": "Cancelar a conexão à {ApplicationName}", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { "id": "Help ...", @@ -73,79 +73,97 @@ "translation": "Fazer uma doação ..." }, { - "id": "About ...", - "message": "About ...", - "translation": "Sobre ..." - }, - { "id": "Quit", "message": "Quit", "translation": "Fechar" }, { - "id": "Quit BitmaskVPN", - "message": "Quit BitmaskVPN", - "translation": "Fechar BitmaskVPN" - }, - { "id": "Route traffic through", "message": "Route traffic through", "translation": "Rotear o tráfego através de" }, { - "id": "Use RiseupVPN {Name} gateway", - "message": "Use RiseupVPN {Name} gateway", - "translation": "Usar o gateway {Name} da RiseupVPN", + "id": "Use {ApplicationName} {City} gateway", + "message": "Use {ApplicationName} {City} gateway", + "translation": "Usar o gateway {City} da {ApplicationName}", "placeholders": [ { - "id": "Name", - "string": "%[1]v", + "id": "ApplicationName", + "string": "%[1]s", "type": "string", "underlyingType": "string", "argNum": 1, - "expr": "name" + "expr": "applicationName" + }, + { + "id": "City", + "string": "%[2]v", + "type": "string", + "underlyingType": "string", + "argNum": 2, + "expr": "city" } ] }, { - "id": "RiseupVPN is on", - "message": "RiseupVPN is on", - "translation": "RiseupVPN está ligada" - }, - { - "id": "VPN is on", - "message": "VPN is on", - "translation": "A VPN está ligada" - }, - { - "id": "RiseupVPN is off", - "message": "RiseupVPN is off", - "translation": "RiseupVPN está desligada" - }, - { - "id": "VPN is off", - "message": "VPN is off", - "translation": "A VPN está desligada" - }, - { - "id": "RiseupVPN is starting", - "message": "RiseupVPN is starting", - "translation": "RiseupVPN está sendo iniciada" + "id": "{ApplicationName} on", + "message": "{ApplicationName} on", + "translation": "{ApplicationName} está ligada", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { - "id": "VPN is starting", - "message": "VPN is starting", - "translation": "A VPN está sendo iniciada" + "id": "{ApplicationName} off", + "message": "{ApplicationName} off", + "translation": "{ApplicationName} está desligada", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { - "id": "RiseupVPN is stopping", - "message": "RiseupVPN is stopping", - "translation": "RiseupVPN está sendo parada" + "id": "Connecting to {ApplicationName}", + "message": "Connecting to {ApplicationName}", + "translation": "A {ApplicationName} está sendo iniciada", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { - "id": "VPN is stopping", - "message": "VPN is stopping", - "translation": "A VPN está sendo parada" + "id": "Stopping {ApplicationName}", + "message": "Stopping {ApplicationName}", + "translation": "A {ApplicationName} está sendo parada", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] }, { "id": "Retry", @@ -153,14 +171,19 @@ "translation": "Tentar novamente" }, { - "id": "RiseupVPN is blocking internet", - "message": "RiseupVPN is blocking internet", - "translation": "RiseupVPN está bloqueando a Internet" - }, - { - "id": "VPN is blocking internet", - "message": "VPN is blocking internet", - "translation": "A VPN está bloqueando a Internet" + "id": "{ApplicationName} blocking internet", + "message": "{ApplicationName} blocking internet", + "translation": "{ApplicationName} está bloqueando a Internet", + "placeholders": [ + { + "id": "ApplicationName", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "applicationName" + } + ] } ] } @@ -24,7 +24,8 @@ import ( ) const ( - provider = "riseup.net" + provider = "riseup.net" + applicationName = "RiseupVPN" ) var printer *message.Printer @@ -56,11 +56,11 @@ func (bt *bmTray) onReady() { bt.mStatus = systray.AddMenuItem(printer.Sprintf("Checking status..."), "") bt.mStatus.Disable() - bt.mTurnOn = systray.AddMenuItem(printer.Sprintf("Turn on"), printer.Sprintf("Turn RiseupVPN on")) + bt.mTurnOn = systray.AddMenuItem(printer.Sprintf("Turn on"), "") bt.mTurnOn.Hide() - bt.mTurnOff = systray.AddMenuItem(printer.Sprintf("Turn off"), printer.Sprintf("Turn RiseupVPN off")) + bt.mTurnOff = systray.AddMenuItem(printer.Sprintf("Turn off"), "") bt.mTurnOff.Hide() - bt.mCancel = systray.AddMenuItem(printer.Sprintf("Cancel"), printer.Sprintf("Cancel connection to RiseupVPN")) + bt.mCancel = systray.AddMenuItem(printer.Sprintf("Cancel"), printer.Sprintf("Cancel connection to %s", applicationName)) bt.mCancel.Hide() systray.AddSeparator() @@ -72,7 +72,7 @@ func (bt *bmTray) onReady() { bt.mDonate = systray.AddMenuItem(printer.Sprintf("Donate ..."), "") systray.AddSeparator() - mQuit := systray.AddMenuItem(printer.Sprintf("Quit"), printer.Sprintf("Quit BitmaskVPN")) + mQuit := systray.AddMenuItem(printer.Sprintf("Quit"), "") go func() { ch := bt.bm.GetStatusCh() @@ -121,13 +121,13 @@ func (bt *bmTray) addGateways() { mGateway := systray.AddMenuItem(printer.Sprintf("Route traffic through"), "") mGateway.Disable() - for i, name := range gatewayList { - menuItem := systray.AddMenuItem(name, printer.Sprintf("Use RiseupVPN %v gateway", name)) - gateway := gatewayTray{menuItem, name} + for i, city := range gatewayList { + menuItem := systray.AddMenuItem(city, printer.Sprintf("Use %s %v gateway", applicationName, city)) + gateway := gatewayTray{menuItem, city} if i == 0 { menuItem.Check() - menuItem.SetTitle("*" + name) + menuItem.SetTitle("*" + city) bt.activeGateway = &gateway } else { menuItem.Uncheck() @@ -158,23 +158,18 @@ func (bt *bmTray) changeStatus(status string) { bt.waitCh = nil } + var statusStr string switch status { case "on": systray.SetIcon(icon.On) - systray.SetTooltip(printer.Sprintf("RiseupVPN is on")) - bt.mStatus.SetTitle(printer.Sprintf("VPN is on")) - bt.mStatus.SetTooltip(printer.Sprintf("RiseupVPN is on")) - + statusStr = printer.Sprintf("%s on", applicationName) bt.mTurnOn.Hide() bt.mTurnOff.Show() bt.mCancel.Hide() case "off": systray.SetIcon(icon.Off) - systray.SetTooltip(printer.Sprintf("RiseupVPN is off")) - bt.mStatus.SetTitle(printer.Sprintf("VPN is off")) - bt.mStatus.SetTooltip(printer.Sprintf("RiseupVPN is off")) - + statusStr = printer.Sprintf("%s off", applicationName) bt.mTurnOn.Show() bt.mTurnOff.Hide() bt.mCancel.Hide() @@ -182,10 +177,7 @@ func (bt *bmTray) changeStatus(status string) { case "starting": bt.waitCh = make(chan bool) go bt.waitIcon() - systray.SetTooltip(printer.Sprintf("RiseupVPN is starting")) - bt.mStatus.SetTitle(printer.Sprintf("VPN is starting")) - bt.mStatus.SetTooltip(printer.Sprintf("RiseupVPN is starting")) - + statusStr = printer.Sprintf("Connecting to %s", applicationName) bt.mTurnOn.Hide() bt.mTurnOff.Hide() bt.mCancel.Show() @@ -193,10 +185,7 @@ func (bt *bmTray) changeStatus(status string) { case "stopping": bt.waitCh = make(chan bool) go bt.waitIcon() - systray.SetTooltip(printer.Sprintf("RiseupVPN is stopping")) - bt.mStatus.SetTitle(printer.Sprintf("VPN is stopping")) - bt.mStatus.SetTooltip(printer.Sprintf("RiseupVPN is stopping")) - + statusStr = printer.Sprintf("Stopping %s", applicationName) bt.mTurnOn.Hide() bt.mTurnOff.Hide() bt.mCancel.Hide() @@ -204,14 +193,14 @@ func (bt *bmTray) changeStatus(status string) { case "failed": systray.SetIcon(icon.Blocked) bt.mTurnOn.SetTitle(printer.Sprintf("Retry")) - systray.SetTooltip(printer.Sprintf("RiseupVPN is blocking internet")) - bt.mStatus.SetTitle(printer.Sprintf("VPN is blocking internet")) - bt.mStatus.SetTooltip(printer.Sprintf("RiseupVPN is blocking internet")) - + statusStr = printer.Sprintf("%s blocking internet", applicationName) bt.mTurnOn.Show() bt.mTurnOff.Show() bt.mCancel.Hide() } + + systray.SetTooltip(statusStr) + bt.mStatus.SetTitle(statusStr) } func (bt *bmTray) waitIcon() { |