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 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
......@@ -37,15 +37,15 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="841"
inkscape:window-width="1280"
inkscape:window-height="968"
id="namedview52"
showgrid="true"
inkscape:zoom="25.615385"
inkscape:cx="20.436413"
inkscape:cy="13"
inkscape:window-x="0"
inkscape:window-y="28"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-to-guides="true"
......@@ -160,14 +160,14 @@
<text
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"
x="14.758149"
y="20.166557"
x="16.649334"
y="21.141987"
id="text3035"
sodipodi:linespacing="125%"
transform="scale(0.96099942,1.0405834)"><tspan
transform="scale(0.96099939,1.0405834)"><tspan
sodipodi:role="line"
id="tspan3037"
x="14.758149"
y="20.166557"
x="16.649334"
y="21.141987"
style="font-weight:bold;fill:#fff6f6;fill-opacity:1;-inkscape-font-specification:Sans Bold">#</tspan></text>
</svg>
......@@ -49,6 +49,29 @@
wxPoint DIALOG_PAGES_SETTINGS::s_LastPos( -1, -1 );
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 )
{
......@@ -92,6 +115,18 @@ void DIALOG_PAGES_SETTINGS::initDialog()
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
// Init display value for sheet User size
wxString format = m_TextSheetCount->GetLabel();
......@@ -232,7 +267,10 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( 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 ) )
{
m_orientationComboBox->Enable( false );
......@@ -364,14 +402,15 @@ void DIALOG_PAGES_SETTINGS::OnComment4TextUpdated( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
{
bool retSuccess;
bool retSuccess = false;
m_save_flag = true;
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
const wxString paperType = m_paperSizeComboBox->GetStringSelection();
int idx = m_paperSizeComboBox->GetSelection();
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 ) )
{
GetCustomSizeMilsFromDialog();
......@@ -506,15 +545,11 @@ limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ),
void DIALOG_PAGES_SETTINGS::SetCurrentPageSizeSelection( const wxString& aPaperSize )
{
// use wxChoice to store the sheet type in the wxChoice's choice
// i.e. "A4", "A3", etc, anywhere within the text of the label.
// 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 )
// search all the not translated label list containing our paper type
for( unsigned i = 0; i < m_pageFmt.GetCount(); ++i )
{
// parse each label looking for aPaperSize within it
wxStringTokenizer st( m_paperSizeComboBox->GetString( i ) );
wxStringTokenizer st( m_pageFmt[i] );
while( st.HasMoreTokens() )
{
......@@ -609,8 +644,10 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
{
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
const wxString paperType = m_paperSizeComboBox->GetStringSelection();
int idx = m_paperSizeComboBox->GetSelection();
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 ) )
......
......@@ -38,6 +38,7 @@ class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
private:
EDA_DRAW_FRAME* m_Parent;
BASE_SCREEN* m_Screen;
wxArrayString m_pageFmt; /// list of page sizes (not translated)
bool m_initialized;
bool m_modified;
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/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -34,7 +34,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
m_staticText5->Wrap( -1 );
PaperSizer->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_paperSizeComboBoxChoices[] = { _("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)") };
wxString m_paperSizeComboBoxChoices[] = { _("dummy text") };
int m_paperSizeComboBoxNChoices = sizeof( m_paperSizeComboBoxChoices ) / sizeof( wxString );
m_paperSizeComboBox = new wxChoice( this, ID_CHICE_PAGE_SIZE, wxDefaultPosition, wxDefaultSize, m_paperSizeComboBoxNChoices, m_paperSizeComboBoxChoices, 0 );
m_paperSizeComboBox->SetSelection( 0 );
......@@ -253,6 +253,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
bUpperSizerH->Add( RightColumnSizer, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bUpperSizerH, 1, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
......
......@@ -267,7 +267,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;A4 210x297mm&quot; &quot;A3 297x420mm&quot; &quot;A2 420x594mm&quot; &quot;A1 594x841mm&quot; &quot;A0 841x1189mm&quot; &quot;A 8.5x11in&quot; &quot;B 11x17in&quot; &quot;C 17x22in&quot; &quot;D 22x34in&quot; &quot;E 34x44in&quot; &quot;USLetter 8.5x11in&quot; &quot;USLegal 8.5x14in&quot; &quot;USLedger 11x17in&quot; &quot;User (Custom)&quot;</property>
<property name="choices">&quot;dummy text&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 9 2012)
// C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......
/*
* 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) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
......@@ -305,7 +305,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScree
if( !pageInfo.SetType( pagename ) )
{
aMsgDiag.Printf( _( "Eeschema file dimension definition error \
line %d, \aAbort reading file.\n" ),
line %d,\nAbort reading file.\n" ),
aLine->LineNumber() );
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