Commit e356e6dc authored by jean-pierre charras's avatar jean-pierre charras

Fix issues about translations:

Eeschema: one string with a bad char (\a, not useable in internationalized strings).
Dialog_page_settings: use not translated strings in code, so strings can be freely translated for the UI.
(Initial code was not working with existing translations)
Update 2 icons.
parent 45445dd8
This diff is collapsed.
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
...@@ -37,15 +37,15 @@ ...@@ -37,15 +37,15 @@
guidetolerance="10" guidetolerance="10"
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1600" inkscape:window-width="1280"
inkscape:window-height="841" inkscape:window-height="968"
id="namedview52" id="namedview52"
showgrid="true" showgrid="true"
inkscape:zoom="25.615385" inkscape:zoom="25.615385"
inkscape:cx="20.436413" inkscape:cx="20.436413"
inkscape:cy="13" inkscape:cy="13"
inkscape:window-x="0" inkscape:window-x="-4"
inkscape:window-y="28" inkscape:window-y="-4"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="svg2" inkscape:current-layer="svg2"
inkscape:snap-to-guides="true" inkscape:snap-to-guides="true"
...@@ -160,14 +160,14 @@ ...@@ -160,14 +160,14 @@
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:13.32437897px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#fff6f6;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:13.32437897px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#fff6f6;fill-opacity:1;stroke:none;font-family:Sans"
x="14.758149" x="16.649334"
y="20.166557" y="21.141987"
id="text3035" id="text3035"
sodipodi:linespacing="125%" sodipodi:linespacing="125%"
transform="scale(0.96099942,1.0405834)"><tspan transform="scale(0.96099939,1.0405834)"><tspan
sodipodi:role="line" sodipodi:role="line"
id="tspan3037" id="tspan3037"
x="14.758149" x="16.649334"
y="20.166557" y="21.141987"
style="font-weight:bold;fill:#fff6f6;fill-opacity:1;-inkscape-font-specification:Sans Bold">#</tspan></text> style="font-weight:bold;fill:#fff6f6;fill-opacity:1;-inkscape-font-specification:Sans Bold">#</tspan></text>
</svg> </svg>
...@@ -49,6 +49,29 @@ ...@@ -49,6 +49,29 @@
wxPoint DIALOG_PAGES_SETTINGS::s_LastPos( -1, -1 ); wxPoint DIALOG_PAGES_SETTINGS::s_LastPos( -1, -1 );
wxSize DIALOG_PAGES_SETTINGS::s_LastSize; wxSize DIALOG_PAGES_SETTINGS::s_LastSize;
// List of page formats.
// should be statically initialized, because we need both
// the translated and the not translated version.
// when displayed in dialog we should explicitely call wxGetTranslation()
// to show the translated version.
const wxString pageFmts[] =
{
_("A4 210x297mm"),
_("A3 297x420mm"),
_("A2 420x594mm"),
_("A1 594x841mm"),
_("A0 841x1189mm"),
_("A 8.5x11in"),
_("B 11x17in"),
_("C 17x22in"),
_("D 22x34in"),
_("E 34x44in"),
_("USLetter 8.5x11in"),
_("USLegal 8.5x14in"),
_("USLedger 11x17in"),
_("User (Custom)"),
wxT("") // end of list
};
void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event ) void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
{ {
...@@ -92,6 +115,18 @@ void DIALOG_PAGES_SETTINGS::initDialog() ...@@ -92,6 +115,18 @@ void DIALOG_PAGES_SETTINGS::initDialog()
SetFocus(); SetFocus();
// initalize page format choice box and page format list.
// The first shows translated strings, the second contains not tralated strings
m_paperSizeComboBox->Clear();
for( unsigned ii = 0; ; ii++ )
{
if( pageFmts[ii].IsEmpty() )
break;
m_pageFmt.Add( pageFmts[ii] );
m_paperSizeComboBox->Append( wxGetTranslation( pageFmts[ii] ) );
}
#ifdef EESCHEMA #ifdef EESCHEMA
// Init display value for sheet User size // Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel(); wxString format = m_TextSheetCount->GetLabel();
...@@ -232,7 +267,10 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event ) ...@@ -232,7 +267,10 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event ) void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
{ {
wxString paperType = m_paperSizeComboBox->GetStringSelection(); int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 )
idx = 0;
const wxString paperType = m_pageFmt[idx];
if( paperType.Contains( PAGE_INFO::Custom ) ) if( paperType.Contains( PAGE_INFO::Custom ) )
{ {
m_orientationComboBox->Enable( false ); m_orientationComboBox->Enable( false );
...@@ -364,14 +402,15 @@ void DIALOG_PAGES_SETTINGS::OnComment4TextUpdated( wxCommandEvent& event ) ...@@ -364,14 +402,15 @@ void DIALOG_PAGES_SETTINGS::OnComment4TextUpdated( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
{ {
bool retSuccess; bool retSuccess = false;
m_save_flag = true; m_save_flag = true;
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations int idx = m_paperSizeComboBox->GetSelection();
const wxString paperType = m_paperSizeComboBox->GetStringSelection(); if( idx < 0 )
idx = 0;
const wxString paperType = m_pageFmt[idx];
// here we assume translators will keep original paper size spellings
if( paperType.Contains( PAGE_INFO::Custom ) ) if( paperType.Contains( PAGE_INFO::Custom ) )
{ {
GetCustomSizeMilsFromDialog(); GetCustomSizeMilsFromDialog();
...@@ -506,15 +545,11 @@ limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ), ...@@ -506,15 +545,11 @@ limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ),
void DIALOG_PAGES_SETTINGS::SetCurrentPageSizeSelection( const wxString& aPaperSize ) void DIALOG_PAGES_SETTINGS::SetCurrentPageSizeSelection( const wxString& aPaperSize )
{ {
// use wxChoice to store the sheet type in the wxChoice's choice // search all the not translated label list containing our paper type
// i.e. "A4", "A3", etc, anywhere within the text of the label. for( unsigned i = 0; i < m_pageFmt.GetCount(); ++i )
// D(printf("m_paperSizeComboBox->GetCount() = %d\n", (int) m_paperSizeComboBox->GetCount() );)
// search all the child wxRadioButtons for a label containing our paper type
for( unsigned i = 0; i < m_paperSizeComboBox->GetCount(); ++i )
{ {
// parse each label looking for aPaperSize within it // parse each label looking for aPaperSize within it
wxStringTokenizer st( m_paperSizeComboBox->GetString( i ) ); wxStringTokenizer st( m_pageFmt[i] );
while( st.HasMoreTokens() ) while( st.HasMoreTokens() )
{ {
...@@ -609,8 +644,10 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() ...@@ -609,8 +644,10 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
{ {
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations int idx = m_paperSizeComboBox->GetSelection();
const wxString paperType = m_paperSizeComboBox->GetStringSelection(); if( idx < 0 )
idx = 0;
const wxString paperType = m_pageFmt[idx];
// here we assume translators will keep original paper size spellings // here we assume translators will keep original paper size spellings
if( paperType.Contains( PAGE_INFO::Custom ) ) if( paperType.Contains( PAGE_INFO::Custom ) )
......
...@@ -38,6 +38,7 @@ class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE ...@@ -38,6 +38,7 @@ class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
private: private:
EDA_DRAW_FRAME* m_Parent; EDA_DRAW_FRAME* m_Parent;
BASE_SCREEN* m_Screen; BASE_SCREEN* m_Screen;
wxArrayString m_pageFmt; /// list of page sizes (not translated)
bool m_initialized; bool m_initialized;
bool m_modified; bool m_modified;
bool m_save_flag; bool m_save_flag;
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 9 2012) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PAGE_SETTINGS_BASE_H__ #ifndef __DIALOG_PAGE_SETTINGS_BASE_H__
#define __DIALOG_PAGE_SETTINGS_BASE_H__ #define __DIALOG_PAGE_SETTINGS_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/valtext.h> #include <wx/valtext.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#define ID_CHICE_PAGE_SIZE 1000 #define ID_CHICE_PAGE_SIZE 1000
#define ID_CHOICE_PAGE_ORIENTATION 1001 #define ID_CHOICE_PAGE_ORIENTATION 1001
#define ID_TEXTCTRL_USER_PAGE_SIZE_X 1002 #define ID_TEXTCTRL_USER_PAGE_SIZE_X 1002
...@@ -50,65 +50,65 @@ ...@@ -50,65 +50,65 @@
#define ID_CHECKBOX_COMMENT3 1015 #define ID_CHECKBOX_COMMENT3 1015
#define ID_TEXTCTRL_COMMENT4 1016 #define ID_TEXTCTRL_COMMENT4 1016
#define ID_CHECKBOX_COMMENT4 1017 #define ID_CHECKBOX_COMMENT4 1017
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PAGES_SETTINGS_BASE /// Class DIALOG_PAGES_SETTINGS_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_PAGES_SETTINGS_BASE : public wxDialog class DIALOG_PAGES_SETTINGS_BASE : public wxDialog
{ {
private: private:
protected: protected:
wxStaticText* m_staticText5; wxStaticText* m_staticText5;
wxChoice* m_paperSizeComboBox; wxChoice* m_paperSizeComboBox;
wxStaticText* m_staticText6; wxStaticText* m_staticText6;
wxChoice* m_orientationComboBox; wxChoice* m_orientationComboBox;
wxTextCtrl* m_TextUserSizeX; wxTextCtrl* m_TextUserSizeX;
wxTextCtrl* m_TextUserSizeY; wxTextCtrl* m_TextUserSizeY;
wxStaticBitmap* m_PageLayoutExampleBitmap; wxStaticBitmap* m_PageLayoutExampleBitmap;
wxStaticText* m_TextSheetCount; wxStaticText* m_TextSheetCount;
wxStaticText* m_TextSheetNumber; wxStaticText* m_TextSheetNumber;
wxTextCtrl* m_TextRevision; wxTextCtrl* m_TextRevision;
wxCheckBox* m_RevisionExport; wxCheckBox* m_RevisionExport;
wxTextCtrl* m_TextTitle; wxTextCtrl* m_TextTitle;
wxCheckBox* m_TitleExport; wxCheckBox* m_TitleExport;
wxTextCtrl* m_TextCompany; wxTextCtrl* m_TextCompany;
wxCheckBox* m_CompanyExport; wxCheckBox* m_CompanyExport;
wxTextCtrl* m_TextComment1; wxTextCtrl* m_TextComment1;
wxCheckBox* m_Comment1Export; wxCheckBox* m_Comment1Export;
wxTextCtrl* m_TextComment2; wxTextCtrl* m_TextComment2;
wxCheckBox* m_Comment2Export; wxCheckBox* m_Comment2Export;
wxTextCtrl* m_TextComment3; wxTextCtrl* m_TextComment3;
wxCheckBox* m_Comment3Export; wxCheckBox* m_Comment3Export;
wxTextCtrl* m_TextComment4; wxTextCtrl* m_TextComment4;
wxCheckBox* m_Comment4Export; wxCheckBox* m_Comment4Export;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnPaperSizeChoice( wxCommandEvent& event ) { event.Skip(); } virtual void OnPaperSizeChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPageOrientationChoice( wxCommandEvent& event ) { event.Skip(); } virtual void OnPageOrientationChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRevisionTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnRevisionTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTitleTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnTitleTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCompanyTextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnCompanyTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment1TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment1TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment2TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment2TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment3TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment3TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment4TextUpdated( wxCommandEvent& event ) { event.Skip(); } virtual void OnComment4TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 748,495 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 748,495 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PAGES_SETTINGS_BASE(); ~DIALOG_PAGES_SETTINGS_BASE();
}; };
#endif //__DIALOG_PAGE_SETTINGS_BASE_H__ #endif //__DIALOG_PAGE_SETTINGS_BASE_H__
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* *
...@@ -305,7 +305,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScree ...@@ -305,7 +305,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScree
if( !pageInfo.SetType( pagename ) ) if( !pageInfo.SetType( pagename ) )
{ {
aMsgDiag.Printf( _( "Eeschema file dimension definition error \ aMsgDiag.Printf( _( "Eeschema file dimension definition error \
line %d, \aAbort reading file.\n" ), line %d,\nAbort reading file.\n" ),
aLine->LineNumber() ); aLine->LineNumber() );
aMsgDiag << FROM_UTF8( line ); aMsgDiag << FROM_UTF8( line );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment