Ugly hack to automatically update translations.

This commit is contained in:
Jakob Borg 2014-07-28 15:14:02 +02:00
parent 7148cf99f7
commit 6805ac915b
10 changed files with 133 additions and 39 deletions

File diff suppressed because one or more lines are too long

View File

@ -102,6 +102,12 @@ xdr() {
done
}
transifex() {
pushd gui
go run ../cmd/transifexdl/main.go
popd
}
case "$1" in
"")
shift
@ -208,6 +214,10 @@ case "$1" in
xdr
;;
transifex)
transifex
;;
*)
echo "Unknown build parameter $1"
;;

79
cmd/transifexdl/main.go Normal file
View File

@ -0,0 +1,79 @@
package main
import (
"encoding/json"
"log"
"net/http"
"os"
"sort"
)
type stat struct {
Translated int `json:"translated_entities"`
Untranslated int `json:"untranslated_entities"`
}
type translation struct {
Content string
}
func main() {
resp := req("https://www.transifex.com/api/2/project/syncthing/resource/gui/stats")
var stats map[string]stat
err := json.NewDecoder(resp.Body).Decode(&stats)
if err != nil {
log.Fatal(err)
}
resp.Body.Close()
var langs []string
for code, stat := range stats {
shortCode := code[:2]
if shortCode == "en" {
continue
}
if pct := 100 * stat.Translated / (stat.Translated + stat.Untranslated); pct < 95 {
log.Printf("Skipping language %q (too low completion ratio %d%%)", shortCode, pct)
os.Remove("lang-" + shortCode + ".json")
continue
}
log.Printf("Updating language %q", shortCode)
langs = append(langs, shortCode)
resp := req("https://www.transifex.com/api/2/project/syncthing/resource/gui/translation/" + code)
var t translation
err := json.NewDecoder(resp.Body).Decode(&t)
if err != nil {
log.Fatal(err)
}
resp.Body.Close()
fd, err := os.Create("lang-" + shortCode + ".json")
if err != nil {
log.Fatal(err)
}
fd.WriteString(t.Content)
fd.Close()
}
sort.Strings(langs)
json.NewEncoder(os.Stdout).Encode(langs)
}
func req(url string) *http.Response {
user := os.Getenv("TRANSIFEX_USER")
pass := os.Getenv("TRANSIFEX_PASS")
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatal(err)
}
req.SetBasicAuth(user, pass)
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
return resp
}

View File

@ -9,7 +9,7 @@
var syncthing = angular.module('syncthing', ['pascalprecht.translate']);
var urlbase = 'rest';
var validLangs = ['de', 'en', 'es', 'fr', 'pt', 'sv'];
var validLangs = ["de","es","fr","pt","sv"];
syncthing.config(function ($httpProvider, $translateProvider) {
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-Token';

View File

@ -101,6 +101,7 @@
"Upgrade To {%version%}": "Upgrade auf {{version}}",
"Upload Rate": "Uploadgeschwindigkeit",
"Usage": "Benutzung",
"Use Compression": "Benutze Komprimierung",
"Use HTTPS for GUI": "Benutze HTTPS für Benutzeroberfläche",
"Version": "Version",
"When adding a new node, keep in mind that this node must be added on the other side too.": "Beachte beim hinzufügen eines neuen Kontens, dass dieser Knoten auch auf der anderen Seite hinzugefügt werden muss.",

View File

@ -109,4 +109,4 @@
"Yes": "Yes",
"You must keep at least one version.": "You must keep at least one version.",
"items": "items"
}
}

View File

@ -13,7 +13,7 @@
"Close": "Cerrar",
"Copyright © 2014 Jakob Borg and the following Contributors:": "Derechos de autor © 2014 Jakob Borg y los siguientes colaboradores:",
"Delete": "Suprimir",
"Disconnected": "Disconnected",
"Disconnected": "Desconectado",
"Documentation": "Documentación",
"Download Rate": "Tasa de descarga",
"Edit": "Editar",
@ -33,7 +33,7 @@
"Generate": "Generar",
"Global Discovery": "Búsqueda en internet",
"Global Repository": "Repositorio global",
"Idle": "Idle",
"Idle": "Inactivo",
"Ignore Permissions": "Ignorar permisos",
"Keep Versions": "Conservar versiones",
"Latest Release": "Última versión",
@ -65,7 +65,7 @@
"Restart": "Reiniciar",
"Restart Needed": "Es necesario reiniciar",
"Save": "Guardar",
"Scanning": "Scanning",
"Scanning": "Actualización",
"Select the nodes to share this repository with.": "Seleccione los nodos con los cuales compartir el repositorio.",
"Settings": "Configuración",
"Share With Nodes": "Compartir con los nodos",
@ -76,11 +76,11 @@
"Shutdown": "Apagar",
"Source Code": "Código fuente",
"Start Browser": "Iniciar navegador",
"Stopped": "Stopped",
"Stopped": "Parado",
"Support / Forum": "Soporte / Foro",
"Sync Protocol Listen Addresses": "Dirección de escucha del protocolo de sincronización",
"Synchronization": "Sincronización",
"Syncing": "Syncing",
"Syncing": "Sincronización",
"Syncthing has been shut down.": "La sincronización esta apagada",
"Syncthing includes the following software or portions thereof:": "Syncthing incluye los siguientes softwares o partes de ellos:",
"Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…": "Syncthing parece estar apagado, o hay un problema con su conexión de Internet. Reintentando...",
@ -96,11 +96,12 @@
"The repository ID must be a short identifier (64 characters or less) consisting of letters, numbers and the the dot (.), dash (-) and underscode (_) characters only.": "El ID de repositorio debe ser una cadena corta (64 caracteres o menos) consistente solamente en letras, números, punto (.), guion (-) y guion bajo (_).",
"The repository ID must be unique.": "El ID de repositorio debe ser único.",
"The repository path cannot be blank.": "La ruta del repositorio no puede estar vacía.",
"Unknown": "Unknown",
"Up to Date": "Up to Date",
"Unknown": "Desconocido",
"Up to Date": "Actualizado",
"Upgrade To {%version%}": "Actualizar a {{version}}",
"Upload Rate": "Tasa de subida",
"Usage": "Utilización",
"Use Compression": "Use Compression",
"Use HTTPS for GUI": "Usar HTTPS para la GUI",
"Version": "Versión",
"When adding a new node, keep in mind that this node must be added on the other side too.": "Al agregar un nuevo nodo, recuerde que este nodo debe ser agregado en el otro lado también.",

View File

@ -42,7 +42,7 @@
"Local Repository": "Dossier local",
"Master Repo": "Dossier maître",
"Max File Change Rate (KiB/s)": "Débit maximum de changement de fichier (KiB/s)",
"Max Outstanding Requests": "Nombre maximum de demandes conccurentes pour des blocs de fichier",
"Max Outstanding Requests": "Nombre maximum de demandes conccurentes de blocs de fichier",
"No": "Non",
"Node ID": "ID du nœud",
"Node Name": "Nom du nœud",
@ -101,6 +101,7 @@
"Upgrade To {%version%}": "Upgrader vers {{version}}",
"Upload Rate": "Débit Upload",
"Usage": "Utilisation",
"Use Compression": "Utiliser la compression",
"Use HTTPS for GUI": "Utiliser l'HTTPS pour le GUI",
"Version": "Version",
"When adding a new node, keep in mind that this node must be added on the other side too.": "Lorsqu'un nœud est ajouté, gardez à l'esprit que ce nœud doit aussi être ajouté de l'autre coté.",

View File

@ -9,11 +9,11 @@
"Announce Server": "Servidor de anúncios",
"Anonymous Usage Reporting": "Envio de Relatórios Anónimos",
"Bugs": "Erros",
"CPU Utilization": "Utilização CPU",
"CPU Utilization": "Utilização da CPU",
"Close": "Fechar",
"Copyright © 2014 Jakob Borg and the following Contributors:": "Direitos Reservados © 2014 Jakob Borg e os seguintes Contribuidores:",
"Delete": "Apagar",
"Disconnected": "Disconnected",
"Disconnected": "Desconectado",
"Documentation": "Documentação",
"Download Rate": "Taxa de transferência",
"Edit": "Editar",
@ -22,8 +22,8 @@
"Enable UPnP": "Ativar UPnP",
"Enter comma separated \"ip:port\" addresses or \"dynamic\" to perform automatic discovery of the address.": "Introduza endereços \"ip:porto\" separados por virgulas ou \"dynamic\" para o descobrimento automático do endereço.",
"Error": "Erro",
"File Versioning": " ",
"File permission bits are ignored when looking for changes. Use on FAT filesystems.": "As permissões do ficheiro são ignoradas na pesquisa por mudanças. Utilize nos sistemas de ficheiros FAT",
"File Versioning": "Gestão de versões",
"File permission bits are ignored when looking for changes. Use on FAT filesystems.": "As permissões do ficheiro são ignoradas na pesquisa por mudanças. Utilize nos sistemas de ficheiros FAT.",
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by syncthing.": "Os ficheiros são movidos para versões carimbadas com o tempo numa pasta .stversions quando substituídos ou apagados por syncthing.",
"Files are protected from changes made on other nodes, but changes made on this node will be sent to the rest of the cluster.": "Os ficheiros são protegidos de mudanças feitas em outros nós, mas alterações feitas neste nó serão enviadas para o resto do agrupamento.",
"Folder": "Pasta",
@ -33,61 +33,61 @@
"Generate": "Gerar",
"Global Discovery": "Descoberta Global",
"Global Repository": "Repositório Global",
"Idle": "Idle",
"Idle": "Em espera",
"Ignore Permissions": "Ignorar Permissões",
"Keep Versions": "Manter Versões",
"Latest Release": "Última versão",
"Local Discovery": "Descoberta Local",
"Local Discovery Port": "Porto Descoberta Local",
"Local Discovery Port": "Porto de Descoberta Local",
"Local Repository": "Repositório local",
"Master Repo": "Repositório Mestre",
"Max File Change Rate (KiB/s)": "Taxa máxima te troca ficheiros (KiB/s)",
"Max Outstanding Requests": "Numero máximo de pedidos pendentes",
"Max File Change Rate (KiB/s)": "Taxa máxima de troca de ficheiros (KiB/s)",
"Max Outstanding Requests": "Número máximo de pedidos pendentes",
"No": "Não",
"Node ID": "Id do Nó",
"Node ID": "ID do Nó",
"Node Name": "Nome do Nó",
"Notice": "Nota",
"OK": "OK",
"Offline": "Desconectado",
"Online": "Conectado",
"Out Of Sync": "Não sincronizado",
"Outgoing Rate Limit (KiB/s)": "Limite taxa envio (KiB/s)",
"Outgoing Rate Limit (KiB/s)": "Limite da taxa de envio (KiB/s)",
"Override Changes": "Sobrepor Mudanças",
"Path to the repository on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "Caminho para o repositório no computador local. Será criado se não existir. O carácter (~) pode ser utilizado como atalho para",
"Please wait": "Aguarde",
"Preview Usage Report": "Visualização de Relatório",
"RAM Utilization": "Utilização RAM",
"RAM Utilization": "Utilização da RAM",
"Reconnect Interval (s)": "Intervalo de reestabelecimento de ligação (s)",
"Repository ID": "ID do Repositório",
"Repository Master": "Repositório Mestre",
"Repository Path": "Caminho do Repositório",
"Rescan Interval (s)": "Intervalo de monitorização (s)",
"Restart": "Reniniciar",
"Restart": "Reiniciar",
"Restart Needed": "É preciso reiniciar",
"Save": "Gravar",
"Scanning": "Scanning",
"Scanning": "Varrendo",
"Select the nodes to share this repository with.": "Selecione os nós com quais partilhar este repositório.",
"Settings": "Configurações",
"Share With Nodes": "Partilhar com Nós",
"Shared With": "Partilhado Com",
"Short identifier for the repository. Must be the same on all cluster nodes.": "Identificador curto para o repositório. Tem que ser igual em todos os nós do agrupamento.",
"Show ID": "Mostrar ID",
"Shown instead of Node ID in the cluster status.": "Mostrado invés do ID do Nó no estado do agrupamento.",
"Shown instead of Node ID in the cluster status.": "Mostrado ao invés do ID do Nó no estado do agrupamento.",
"Shutdown": "Desligar",
"Source Code": "Código Fonte",
"Start Browser": "Iniciar Navegador",
"Stopped": "Stopped",
"Stopped": "Parado",
"Support / Forum": "Suporte / Fórum",
"Sync Protocol Listen Addresses": "Endereços de escuta do protocolo de sincronização",
"Synchronization": "Sincronização",
"Syncing": "Syncing",
"Syncing": "Sincronizando",
"Syncthing has been shut down.": "Syncthing foi desligado.",
"Syncthing includes the following software or portions thereof:": "Syncthing inclui as seguintes aplicacoes ou partes delas:",
"Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…": "Syncthing parece estar em baixo, ou existe um problema com a sua ligação Internet. A tentar novamente...",
"The aggregated statistics are publicly available at {{url}}": "As estatísticas agrupadas estão disponíveis publicamente em {{url}}",
"The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.": "A configuração foi gravada mas não ativada. Syncthing tem que reiniciar para ativar a nova configuração.",
"The encrypted usage report is sent daily. It is used to track common platforms, repo sizes and app versions. If the reported data set is changed you will be prompted with this dialog again.": "O relatório de utilização cifrado é enviado diariamente. É utilizado para seguir plataformas comuns, tamanhos de repositórios e versões da aplicação. Se o tipo de dados do relatório é alterado será notificado novamente através desta janela.",
"The entered node ID does not look valid. It should be a 52 character string consisting of letters and numbers, with spaces and dashes being optional.": "O ID do nó indicado não parece válido. Deveria conter uma palavra de 52 carateres constituída por letras e números, com os espaços e traços opcionais. ",
"The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.": "A configuração foi gravada mas não activada. Syncthing tem que reiniciar para activar a nova configuração.",
"The encrypted usage report is sent daily. It is used to track common platforms, repo sizes and app versions. If the reported data set is changed you will be prompted with this dialog again.": "O relatório de utilização cifrado é enviado diariamente. É utilizado para seguir plataformas comuns, tamanhos de repositórios e versões da aplicação. Se o conjunto de dados do relatório for alterado, será notificado novamente através desta janela.",
"The entered node ID does not look valid. It should be a 52 character string consisting of letters and numbers, with spaces and dashes being optional.": "O ID do nó indicado não parece ser válido. Deveria conter uma palavra de 52 caracteres constituída por letras e números, com espaços e traços opcionais. ",
"The node ID cannot be blank.": "O ID do nó não pode ser vazio.",
"The node ID to enter here can be found in the \"Edit > Show ID\" dialog on the other node. Spaces and dashes are optional (ignored).": "O ID do nó a introduzir pode ser encontrado no diálogo \"Editar > Mostrar ID\" no outro nó. Espaços e traços são opcionais (ignorados).",
"The number of old versions to keep, per file.": "O número de versões antigas a manter, por ficheiro.",
@ -96,15 +96,16 @@
"The repository ID must be a short identifier (64 characters or less) consisting of letters, numbers and the the dot (.), dash (-) and underscode (_) characters only.": "O ID do repositório tem que ser um identificador curto (64 carateres ou menos) e consiste em letras, números e os carateres ponto (.), traço (-) e (_).",
"The repository ID must be unique.": "O ID do repositório tem que ser único.",
"The repository path cannot be blank.": "O caminho do repositório não pode ser vazio.",
"Unknown": "Unknown",
"Up to Date": "Up to Date",
"Unknown": "Desconhecido",
"Up to Date": "Actualizado",
"Upgrade To {%version%}": "Atualizar para {{version}}",
"Upload Rate": "Taxa de envio",
"Usage": "Utilização",
"Use Compression": "Use Compression",
"Use HTTPS for GUI": "Utilizar HTTPS para GUI",
"Version": "Versão",
"When adding a new node, keep in mind that this node must be added on the other side too.": "Quando adicionar um novo nó, lembre-se que este nó tem que ser adicionado do outro lado também.",
"When adding a new repository, keep in mind that the Repository ID is used to tie repositories together between nodes. They are case sensitive and must match exactly between all nodes.": "Quando adicionar um novo repositório, lembre-se que o ID do Repositório é utilizado para juntar os repositórios entre nós. São sensíveis às maiúsculas e minúsculas e tem que corresponder exatamente entre todos os nós.",
"When adding a new repository, keep in mind that the Repository ID is used to tie repositories together between nodes. They are case sensitive and must match exactly between all nodes.": "Quando adicionar um novo repositório, lembre-se que o ID do Repositório é utilizado para juntar os repositórios entre nós. São sensíveis às maiúsculas e minúsculas e tem que corresponder exactamente entre todos os nós.",
"Yes": "Sim",
"You must keep at least one version.": "Tem que manter pelo menos uma versão.",
"items": "itens"

View File

@ -101,6 +101,7 @@
"Upgrade To {%version%}": "Uppgradera till {{version}}",
"Upload Rate": "Uppladdningshastighet",
"Usage": "Användande",
"Use Compression": "Använd komprimering",
"Use HTTPS for GUI": "Använd HTTPS för GUI",
"Version": "Version",
"When adding a new node, keep in mind that this node must be added on the other side too.": "När du lägger till en ny nod, kom ihåg att den här noden måste läggas till på den andra noden också.",