From 5149ef33110ecc3ba0d9f8acddeca5d94e80dc78 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 25 Sep 2015 06:03:30 +0000 Subject: [PATCH] Fixed menu items not getting translated. --- common/lc_mainwindow.cpp | 4 +- common/lc_shortcuts.cpp | 6 +- common/lc_shortcuts.h | 4 +- qt/lc_qpreferencesdialog.cpp | 6 +- resources/leocad_pt.ts | 679 ++++++++++++++++++----------------- 5 files changed, 351 insertions(+), 348 deletions(-) diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index b6036efd..4d021857 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -104,8 +104,8 @@ void lcMainWindow::CreateActions() { for (int CommandIdx = 0; CommandIdx < LC_NUM_COMMANDS; CommandIdx++) { - QAction* Action = new QAction(tr(gCommands[CommandIdx].MenuName), this); - Action->setStatusTip(tr(gCommands[CommandIdx].StatusText)); + QAction* Action = new QAction(qApp->translate("Menu", gCommands[CommandIdx].MenuName), this); + Action->setStatusTip(qApp->translate("Status", gCommands[CommandIdx].StatusText)); connect(Action, SIGNAL(triggered()), this, SLOT(ActionTriggered())); addAction(Action); mActions[CommandIdx] = Action; diff --git a/common/lc_shortcuts.cpp b/common/lc_shortcuts.cpp index 0e184f19..fea94a39 100644 --- a/common/lc_shortcuts.cpp +++ b/common/lc_shortcuts.cpp @@ -34,7 +34,7 @@ void lcResetDefaultKeyboardShortcuts() void lcResetKeyboardShortcuts(lcKeyboardShortcuts& Shortcuts) { for (int CommandIdx = 0; CommandIdx < LC_NUM_COMMANDS; CommandIdx++) - strcpy(Shortcuts.Shortcuts[CommandIdx], gCommands[CommandIdx].DefaultShortcut); + Shortcuts.Shortcuts[CommandIdx] = qApp->translate("Shortcut", gCommands[CommandIdx].DefaultShortcut); } bool lcSaveKeyboardShortcuts(const QString& FileName, const lcKeyboardShortcuts& Shortcuts) @@ -53,7 +53,7 @@ bool lcSaveKeyboardShortcuts(lcFile& File, const lcKeyboardShortcuts& Shortcuts) for (int CommandIdx = 0; CommandIdx < LC_NUM_COMMANDS; CommandIdx++) { - if (!Shortcuts.Shortcuts[CommandIdx][0]) + if (Shortcuts.Shortcuts[CommandIdx].isEmpty()) continue; sprintf(Line, "%s=%s\n", gCommands[CommandIdx].ID, Shortcuts.Shortcuts[CommandIdx]); @@ -103,7 +103,7 @@ bool lcLoadKeyboardShortcuts(lcFile& File, lcKeyboardShortcuts& Shortcuts) if (NewLine) *NewLine = 0; - strncpy(Shortcuts.Shortcuts[CommandIdx], Key, LC_SHORTCUT_LENGTH); + Shortcuts.Shortcuts[CommandIdx] = QString::fromUtf8(Key); // todo: qstring } return true; diff --git a/common/lc_shortcuts.h b/common/lc_shortcuts.h index 10bd8a2a..6d4e4ea9 100644 --- a/common/lc_shortcuts.h +++ b/common/lc_shortcuts.h @@ -3,11 +3,9 @@ #include "lc_commands.h" -#define LC_SHORTCUT_LENGTH 32 - struct lcKeyboardShortcuts { - char Shortcuts[LC_NUM_COMMANDS][LC_SHORTCUT_LENGTH]; + QString Shortcuts[LC_NUM_COMMANDS]; }; extern lcKeyboardShortcuts gKeyboardShortcuts; diff --git a/qt/lc_qpreferencesdialog.cpp b/qt/lc_qpreferencesdialog.cpp index 139f23d9..d43bc159 100644 --- a/qt/lc_qpreferencesdialog.cpp +++ b/qt/lc_qpreferencesdialog.cpp @@ -488,7 +488,7 @@ void lcQPreferencesDialog::updateCommandList() item->setText(1, sequence.toString(QKeySequence::NativeText)); item->setData(0, Qt::UserRole, qVariantFromValue(actionIdx)); - if (strcmp(options->KeyboardShortcuts.Shortcuts[actionIdx], gCommands[actionIdx].DefaultShortcut)) + if (options->KeyboardShortcuts.Shortcuts[actionIdx] != gCommands[actionIdx].DefaultShortcut) setShortcutModified(item, true); sections[section]->addChild(item); @@ -528,11 +528,11 @@ void lcQPreferencesDialog::on_shortcutAssign_clicked() return; int shortcutIndex = qvariant_cast(current->data(0, Qt::UserRole)); - strcpy(options->KeyboardShortcuts.Shortcuts[shortcutIndex], ui->shortcutEdit->text().toLocal8Bit().data()); + options->KeyboardShortcuts.Shortcuts[shortcutIndex] = ui->shortcutEdit->text(); current->setText(1, ui->shortcutEdit->text()); - setShortcutModified(current, strcmp(options->KeyboardShortcuts.Shortcuts[shortcutIndex], gCommands[shortcutIndex].DefaultShortcut) != 0); + setShortcutModified(current, options->KeyboardShortcuts.Shortcuts[shortcutIndex] != gCommands[shortcutIndex].DefaultShortcut); options->ShortcutsModified = true; options->ShortcutsDefault = false; diff --git a/resources/leocad_pt.ts b/resources/leocad_pt.ts index 799c03a7..99b879f5 100644 --- a/resources/leocad_pt.ts +++ b/resources/leocad_pt.ts @@ -11,57 +11,57 @@ &Open... - + &Abrir... &Merge... - + Co&mbinar... &Save - + &Gravar Save &As... - + Gravar &Como... Save &Image... - + Gravar &Imagem... 3D &Studio... - + 3D &Studio... &HTML... - + &HTML... &BrickLink... - + &BrickLink... &CSV... - + &CSV... &POV-Ray... - + &POV-Ray... &Wavefront... - + &Wavefront... @@ -81,7 +81,7 @@ &Print... - + Im&primir... @@ -116,87 +116,87 @@ E&xit - + &Saír &Undo - + &Desfazer &Redo - + &Refazer Cu&t - + Cor&tar &Copy - + &Copiar &Paste - + Co&lar &Find... - + &Procurar... Find Ne&xt - + Procurar &Seguinte Find Pre&vious - + Procurar &Anterior Select &All - + Seleccion&ar Tudo Select &None - + Deseleccio&nar Tudo Select &Invert - + &Inverter a selecção Select by Na&me... - + Seleccionar por no&me... Lock X - + Bloquear X Lock Y - + Bloquear Y Lock Z - + Bloquear Z Unlock All - + Bloquear Tudo @@ -204,7 +204,7 @@ None - Nenhum + Nenhum @@ -422,17 +422,17 @@ Pan - + Movimento Horizontal Rotate View - + Rodar Vista Roll - + Inclinar @@ -472,62 +472,62 @@ &Front - + &Frente &Back - + &Traseira &Top - + &Acima B&ottom - + A&baixo &Left - + &Esquerda &Right - + &Direita &Home - + &Base Reset - + Reiniciar First - + Primeiro Previous - + Anterior Next - + Seguinte Last - + Último @@ -557,7 +557,7 @@ &Full Screen - + &Tela Cheia @@ -672,7 +672,7 @@ &Edit Groups... - + &Editar Grupos... @@ -707,7 +707,7 @@ New Model... - + Novo Modelo... @@ -737,7 +737,7 @@ &About... - + &Acerca... @@ -760,12 +760,12 @@ Model # - + Modelo # New Model - + Novo Modelo @@ -800,12 +800,12 @@ Error - + Erro Merged - + Combinado @@ -822,7 +822,7 @@ LeoCAD - + LeoCAD @@ -915,417 +915,417 @@ Ctrl+N - + Ctrl+N Ctrl+O - + Ctrl+O Ctrl+S - + Ctrl+S Ctrl+Z - + Ctrl+Z Ctrl+Y - + Ctrl+Y Ctrl+X - + Ctrl+X Ctrl+C - + Ctrl+C Ctrl+V - + Ctrl+V Ctrl+F - + Ctrl+F F3 - + F3 Shift+F3 - + Shift+F3 Ctrl+A - + Ctrl+A Ctrl+I - + Ctrl+I 0 - 8x {0?} + 8x {0?} 1 - 8x {1?} + 8x {1?} 2 - 8x {2?} + 8x {2?} 3 - 8x {3?} + 8x {3?} 4 - 8x {4?} + 8x {4?} 5 - 8x {5?} + 8x {5?} 6 - 8x {6?} + 8x {6?} 7 - 8x {7?} + 8x {7?} 8 - 8x {8?} + 8x {8?} 9 - 8x {9?} + 8x {9?} Ctrl+Shift+0 - + Ctrl+Shift+0 Ctrl+Shift+1 - + Ctrl+Shift+1 Ctrl+Shift+2 - + Ctrl+Shift+2 Ctrl+Shift+3 - + Ctrl+Shift+3 Ctrl+Shift+4 - + Ctrl+Shift+4 Ctrl+Shift+5 - + Ctrl+Shift+5 Ctrl+Shift+6 - + Ctrl+Shift+6 Ctrl+Shift+7 - + Ctrl+Shift+7 Ctrl+Shift+8 - + Ctrl+Shift+8 Ctrl+Shift+9 - + Ctrl+Shift+9 Shift+0 - + Shift+1 - + Shift+1 Shift+2 - + Shift+2 Shift+3 - + Shift+3 Shift+4 - + Shift+4 Shift+5 - + Shift+5 Shift+6 - + Shift+6 Shift+7 - + Shift+7 Shift+8 - + Shift+8 Shift+9 - + Shift+9 Shift+S - + Shift+S Shift+M - + Shift+M Shift+R - + Shift+R Shift+D - + Shift+D Shift+N - + Shift+N Shift+Z - + Shift+Z Shift+P - + Shift+P Shift+T - + Shift+T Shift+L - + Shift+L Esc - + Esc + - + + - - + - F - + F B - + B T - + T O - + O L - + L R - + R H - + H Alt+Up - + Alt+Up Alt+Left - + Alt+Left Alt+Right - + Alt+Right Alt+Down - + Alt+Down Insert - + Insert Delete - + Delete Down - + Down Up - + Up Right - + Right Left - + Left PgUp - + PgUp PgDown - + PgDown Shift+Down - + Shift+Down Shift+Up - + Shift+Up Shift+Right - + Shift+Right Shift+Left - + Shift+Left Shift+PgUp - + Shift+PgUp Shift+PgDown - + Shift+PgDown Ctrl+G - + Ctrl+G Ctrl+U - + Ctrl+U Ctrl+H - + Ctrl+H @@ -1333,7 +1333,7 @@ Create a new project - + Criar um novo projecto @@ -2100,36 +2100,40 @@ LeoCAD - + LeoCAD LeoCAD could not find a compatible Parts Library so only a small number of parts will be available. Please visit http://www.leocad.org for information on how to download and install a library. - + LeoCAD não achou uma Biblioteca de Peças.compatível portanto só vai haver uma pequena quantia de peças disponível. + +Veja http://www.leocad.org para saber como descarragar e instalar uma biblioteca. LeoCAD could not load Parts Library. Please visit http://www.leocad.org for information on how to download and install a library. - + LeoCAD não conseguiu carregar a Biblioteca de Peças. + +Veja http://www.leocad.org para saber como descarragar e instalar uma biblioteca. Parts library and Anti-aliasing changes will only take effect the next time you start LeoCAD. - + As mudanças de Biblioteca e de Antisserrilhamento só tomam efeito após o próximo arranque do LeoCAD. Parts library changes will only take effect the next time you start LeoCAD. - + As mudanças de Biblioteca só tomam efeito após o próximo arranque do LeoCAD. Anti-aliasing changes will only take effect the next time you start LeoCAD. - + As mudanças de Antisserrilhamento só tomam efeito após o próximo arranque do LeoCAD. @@ -2148,13 +2152,14 @@ Please visit http://www.leocad.org for information on how to download and instal Error - + Erro Error writing to file '%1': %2 - + Erro ao escrever no ficheiro '%1': +%2 @@ -2180,67 +2185,67 @@ Please visit http://www.leocad.org for information on how to download and instal Transform - + Transformar C&ameras - + Câm&aras &File - + &Ficheiro &Export - + &Exportar &Edit - + &Editar &View - + &Ver &Viewpoints - + Ponto de &Vista Projection - + Projecção Ste&p - + &Passo T&oolbars - + &Barras de Ferramentas &Piece - + &Peça &Model - + &Modelo &Help - + A&juda @@ -2341,23 +2346,23 @@ Please visit http://www.leocad.org for information on how to download and instal &Undo - + Desfa&zer &Redo %1 - + &Refazer %1 &Redo - + &Refazer Supported Files (*.lcd *.ldr *.dat *.mpd);;All Files (*.*) - + Ficheiros Aceites (*.lcd *.ldr *.dat *.mpd);;All Files (*.*) @@ -2365,7 +2370,7 @@ Please visit http://www.leocad.org for information on how to download and instal LeoCAD - + @@ -2417,84 +2422,84 @@ Please visit http://www.leocad.org for information on how to download and instal 0 - 8x {0?} + 8x {0?} 1/20S - 8x {1/20S?} + 8x {1/20S?} 1/4S - 8x {1/4S?} + 8x {1/4S?} 1F - 8x {1F?} + 8x {1F?} 1/2S - 8x {1/2S?} + 8x {1/2S?} 1S - 8x {1S?} + 8x {1S?} 2S - 8x {2S?} + 8x {2S?} 3S - 8x {3S?} + 8x {3S?} 4S - 8x {4S?} + 8x {4S?} 8S - 8x {8S?} + 8x {8S?} None - Nenhum + Nenhum 1B - 8x {1B?} + 8x {1B?} 2B - 8x {2B?} + 8x {2B?} 4B - 8x {4B?} + 8x {4B?} 8B - 8x {8B?} + 8x {8B?} @@ -2502,7 +2507,7 @@ Please visit http://www.leocad.org for information on how to download and instal Pasting - + Colando @@ -2511,7 +2516,7 @@ Please visit http://www.leocad.org for information on how to download and instal LeoCAD - + @@ -2538,64 +2543,64 @@ Please visit http://www.leocad.org for information on how to download and instal Grouping - + Agrupar Ungrouping - + Desagrupar Editing Groups - + Editar Grupos Moving - + Mover Rotating - + Rodar Showing - + Mostrar Hiding - + Escoder Setting Color - + Definir a Cor Setting Part - + Definir a Peça Moving Camera - + Mover a Câmara Rotating Camera - + Rodar a Câmara Changing Camera - + Mudar a Câmara @@ -2621,17 +2626,17 @@ Please visit http://www.leocad.org for information on how to download and instal New Camera - + Nova Câmara Move - + Mover Rotate - + Rodar @@ -2639,12 +2644,12 @@ Please visit http://www.leocad.org for information on how to download and instal Zoom - + Zoom Pan - + Movimento Horizontal @@ -2654,32 +2659,32 @@ Please visit http://www.leocad.org for information on how to download and instal Roll - + Inclinar Insert - + Inserir New Light - + Nova Luz Deleting - + Apagando Painting - + Pintado Look At - + Olhar Para @@ -2801,12 +2806,12 @@ GL_EXT_texture_filter_anisotropic extension: %4 Array - + Quadro Dimensions - + Dimensões @@ -2821,7 +2826,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Array is empty. - + O quadro está vazio. @@ -2829,7 +2834,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Category - + Categoria @@ -2890,7 +2895,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Part ID - + ID de Peça @@ -2921,119 +2926,119 @@ GL_EXT_texture_filter_anisotropic extension: %4 HTML Options - + Opções HTML General - + Geral Output folder: - + Pasta de saída: ... - + ... Image format: - + Formato de Imagem: BMP - + JPEG - + JPEG PNG - + PNG Transparent image background - + Fundo de imagem transparente Layout - + Disposição Single page - + Página única One step per page - + Um passo por página Width: - + Largura: Height: - + Altura: Index page - + Página de índice Highlight new parts - + Destacar as novas peças Parts List - + Lista das Peças At the end - + No fim After each step - + Após cada passo Color: - + Cor: Create images - + Criar imagens Output folder cannot be empty. - + aTem de indicar a pasta de saída. Select Output Folder - + Selecionar a Pasta de Saída @@ -3041,67 +3046,67 @@ GL_EXT_texture_filter_anisotropic extension: %4 Save Image - + Gravar Imagem File name: - + Nome do ficheiro: Dimensions - + Dimensões Step Range - + Intervalo de Passos All Steps - + Todos os Passos Current Step - + Passo Actual Custom Range - + Intervalo Personalizado From: - + De: To: - + Até: Width: - + Largura: Height: - + Altura: ... - + ... Output File cannot be empty. - + Tem de indicar o ficheiro de saída. @@ -3111,42 +3116,42 @@ GL_EXT_texture_filter_anisotropic extension: %4 Error - + Erro Please enter a width between 1 and 2048. - + É favor escolher uma largura entre 1 e 2048. Please enter a height between 1 and 2048. - + É favor escolher uma altura entre 1 e 2048. First step must be between 1 and %1. - + O primeiro passo tem de ser entre 1 e %1. Last step must be between 1 and %1. - + O último passo tem de ser entre %1 e 1. Supported Image Files (*.bmp *.png *.jpg);;BMP Files (*.bmp);;PNG Files (*.png);;JPEG Files (*.jpg);;All Files (*.*) - + Formatos de Imagem Aceitados (*.bmp *.png *.jpg);;BMP Files (*.bmp);;PNG Files (*.png);;JPEG Files (*.jpg);;All Files (*.*) Last step must be greater than first step. - + O último passo tem de ser superior au primeiro. Save Image File - + Exportar Imagem @@ -3169,7 +3174,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Dialog - + Diálogo @@ -3177,42 +3182,42 @@ GL_EXT_texture_filter_anisotropic extension: %4 Models - + Modelos &New - + &Novo D&elete... - + &Apagar... &Rename... - + &Mudar o Nome... Move &Up - + &Subir Move &Down - + &Descer Model # - + Modelo # Error - + Erro @@ -3237,7 +3242,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Name: - + Nome: @@ -3270,7 +3275,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Output File - + Ficeiro de saída @@ -3292,12 +3297,12 @@ GL_EXT_texture_filter_anisotropic extension: %4 ... - + ... Output File cannot be empty. - + Tem de indicar o ficheiro de saída. @@ -3317,7 +3322,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 All Files (*.*) - + Todos os Ficheiros (*.*) @@ -3335,12 +3340,12 @@ GL_EXT_texture_filter_anisotropic extension: %4 Models - + Modelos Search Results - + Resultados da Procura @@ -3353,17 +3358,17 @@ GL_EXT_texture_filter_anisotropic extension: %4 General - + Geral Default author name: - + Nome do autor por omissão: Default projects folder: - + Pasta dos projectos por omissão: @@ -3371,12 +3376,12 @@ GL_EXT_texture_filter_anisotropic extension: %4 ... - + ... Custom parts library: - + Bilioteca de peças personalizada: @@ -3396,7 +3401,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Check for updates: - + Procurar actualizações: @@ -3497,7 +3502,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Name - Nome + Nome @@ -3525,58 +3530,58 @@ GL_EXT_texture_filter_anisotropic extension: %4 Category - + Categoria New... - + Novo... Edit... - + Editar... Delete... - + Apagar... Keyboard - + Teclado Keyboard Shortcuts - + Atalhos de Teclado Command - + Commando Shortcut - + Atalho Key sequence: - + Sequência de teclas: Assign - + Definir Remove - + Remover @@ -3601,7 +3606,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 All Files (*.*) - + Todos os Ficheiros (*.*) @@ -3697,92 +3702,92 @@ GL_EXT_texture_filter_anisotropic extension: %4 Properties - + Propriedades Summary - + Resumo Author: - + Autor: Description: - + Descrição: Comments: - + Comentários: Scene - + Cena Background - + Fundo Solid Color - + Cor Sólida Image - + Imagem Gradient - + Gradiente ... - + ... Tile - + Environment - + Ambiente Fog - + Nevoeiro Density - + Densidade Ambient Light - + Luz Set default options for new projects - + Definir por omissão para os novos projectos Parts Used - + Peças Utilizadas @@ -3792,7 +3797,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Part - + Peça @@ -3835,18 +3840,18 @@ GL_EXT_texture_filter_anisotropic extension: %4 Property - + Propriedade Value - + Valor Position - + Posição @@ -3855,7 +3860,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 X - + X @@ -3864,7 +3869,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Y - + Y @@ -3873,78 +3878,78 @@ GL_EXT_texture_filter_anisotropic extension: %4 Z - + Z Rotation - + Rotação Visibility - + Visibilidade Show - + Mostrar Hide - + Esconder Appearance - + Estilo Color - Cor + Cor Part - + Peça Target - + Objectivo Up - + Subir Orthographic - + Ortográfico FOV - + FOV Near - + Perto Far - + Longe Name - Nome + Nome @@ -3975,47 +3980,47 @@ GL_EXT_texture_filter_anisotropic extension: %4 LeoCAD Updates - + Actualizações do LeoCAD Connecting to update server... - + A ligar ao servidor de actualizações... <p>There's a newer version of LeoCAD available for download (%1.%2.%3).</p> - + <p>Existe uma nova versão do LeoCAD em descarregamento (%1.%2.%3).</p> <p>You are using the latest LeoCAD version.</p> - + <p>Tem a última versão do LeoCAD.</p> <p>There are new parts available.</p> - + <p>Existem novas peças disponiveis.</p> <p>There are no new parts available at this time.</p> - + <p>Não há novas peças disponiveis.</p> <p>Visit <a href="http://www.leocad.org/files/">http://www.leocad.org/files/</a> to download.</p> - + Error parsing update information. - + Erro ao ler a informação de actualização. Error connecting to the update server. - + Erro ao ligar ao servidor de actualizações. @@ -4023,7 +4028,7 @@ GL_EXT_texture_filter_anisotropic extension: %4 Step %1 - + Passo %1