Issue 120341 - Rework SCSTR_FIELDSEP so that it is less error-prone
Rework SCSTR_FIELDSEP so that it is less error-prone
Status: RESOLVED FIXED
Product: Calc
Classification: Application
Component: save-export
3.4.0
All All
: P3 normal (vote)
: 4.0.0
Assigned To: Ariel Constenla-Haile
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-22 13:23 UTC by Andrea Pescetti
Modified: 2012-10-10 07:33 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrea Pescetti 2012-07-22 13:23:11 UTC
As discussed by Ariel in http://s.apache.org/rMk :

In main/sc/source/ui/src/scstring.src#483

483 String SCSTR_FIELDSEP
484 {
485 	Text [ en-US ] = ",\t44\t;\t59\t:\t58\t{Tab}\t9\t{space}\t32 " ;
486 };

It would be better to place markers, remove the localization, and
replace the markers (I guess "Tab" and "space" are already translated
somewhere else, or two new string can be created):

String SCSTR_FIELDSEP
 {
 	Text = ",\t44\t;\t59\t:\t58\t{$1}\t9\t{$2}\t32 " ;
};

String SCSTR_FIELDSEP_TAB
 {
 	Text [ en-US ] = "Tab" ;
};

String SCSTR_FIELDSEP_SPACE
 {
 	Text [ en-US ] = "space" ;
};

If someone files a new bug, I [Ariel] can take a look at it.

Note: Bug 120216 is the problem that started this (more general) discussion.
Comment 1 Ariel Constenla-Haile 2012-07-23 01:51:09 UTC
(In reply to comment #0)
> String SCSTR_FIELDSEP
>  {
>  	Text = ",\t44\t;\t59\t:\t58\t{$1}\t9\t{$2}\t32 " ;
> };
> 
> String SCSTR_FIELDSEP_TAB
>  {
>  	Text [ en-US ] = "Tab" ;
> };
> 
> String SCSTR_FIELDSEP_SPACE
>  {
>  	Text [ en-US ] = "space" ;
> };

Looking at it again, it looks less error prone the following:


String SCSTR_FIELDSEP
{
	Text = ",\t44\t;\t59\t:\t58\t{%TAB}\t9\t{%SPACE}\t32 " ;
};

%TAB and %SPACE as placeholders instead of %1 and %2 don't require to track the placeholder position when replacing:

in ScImportOptionsDlg::ScImportOptionsDlg

String sFieldSep( ScResId( SCSTR_FIELDSEP ) );
sFieldSep.SearchAndReplaceAscii( "%TAB",   String(ScResId(SCSTR_FIELDSEP_TAB)) );
sFieldSep.SearchAndReplaceAscii( "%SPACE", String(ScResId(SCSTR_FIELDSEP_SPACE)) );

// im Ctor-Initializer nicht moeglich (MSC kann das nicht):
pFieldSepTab = new ScDelimiterTable( sFieldSep );


SCSTR_FIELDSEP is also used in ScImportAsciiDlg, member variable aFldSepList, which is unused, so I'll remove it.


[ariel@localhost sc]$ cd /build/aoo/src/clean/trunk/main/sc
[ariel@localhost sc]$ git grep SCSTR_FIELDSEP
inc/sc.hrc:#define SCSTR_FIELDSEP                       (STR_START + 61)
source/ui/dbgui/scuiasciiopt.cxx:               aFldSepList     ( ScResId( SCSTR_FIELDSEP ) ),
source/ui/dbgui/scuiimoptdlg.cxx:       pFieldSepTab = new ScDelimiterTable( String(ScResId(SCSTR_FIELDSEP)) );
source/ui/src/scstring.src:String SCSTR_FIELDSEP


[ariel@localhost sc]$ git grep aFldSepList
source/ui/dbgui/scuiasciiopt.cxx:               aFldSepList     ( ScResId( SCSTR_FIELDSEP ) ),
source/ui/inc/asciiopt.hxx://CHINA001 String                      aFldSepList;
source/ui/inc/scuiasciiopt.hxx:    String                      aFldSepList;
Comment 2 SVN Robot 2012-07-23 02:05:37 UTC
"arielch" committed SVN 0 into trunk:
#i120341# - Make SCSTR_FIELDSEP less translation-error-prone
Comment 3 Ariel Constenla-Haile 2012-07-23 02:07:01 UTC
Fixed in trunk
Comment 4 Shenfeng Liu 2012-10-10 07:33:08 UTC
set Target Milestone to AOO 3.5.0 for PM purpose.