Bug 375612

Summary: Session files not portable between different system locales
Product: [Applications] kst Reporter: Jonathan Liu <net147>
Component: generalAssignee: kst
Status: CONFIRMED ---    
Severity: normal CC: netterfield
Priority: NOR    
Version: 2.0.8   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Sample Data File
English session file
German session file

Description Jonathan Liu 2017-01-27 12:49:06 UTC
Kst session files saved on Windows 7 with English locale don't open properly on Windows 7 with German locale. This is because when using German locale, it expects to find items in the session file with German names instead of English names.
Comment 1 Jonathan Liu 2017-01-27 13:01:23 UTC
This can be tested from a command prompt:
1. cd "C:\Program Files (x86)\Kst-2.0.8\bin"
2. set LANG=de_DE
3. kst2.exe
4. Create plot and save session, exit Kst.
5. set LANG=en_US
6. kst2.exe
7. Open the saved session
Comment 2 Netterfield 2017-01-27 14:59:57 UTC
Thanks, Jonathan.

Can you post a couple example session files?
Comment 3 Jonathan Liu 2017-01-28 13:44:29 UTC
Created attachment 103681 [details]
Sample Data File
Comment 4 Jonathan Liu 2017-01-28 13:44:57 UTC
Created attachment 103682 [details]
English session file
Comment 5 Jonathan Liu 2017-01-28 13:45:17 UTC
Created attachment 103683 [details]
German session file
Comment 6 Netterfield 2017-02-03 21:07:32 UTC
This is a ... deep bug.

When no column names are provided by the file, the ascii datasource plugin automatically names the columns "Column 1" etc, and, of course, makes "Column" a translatable string.  So in German it calls it "Spalte 1" etc.

Kst proper knows nothing of the names being automatic or translated - it just knows the list of field names that the datasource provides - and when it saves a vector, it uses the only name it has been given.

Trying to load in a different language fails.

Options:
- don't translate "Column" - field would be called "Column 1", etc, regardless of language.
- don't add "Column" to the automatically generated name of the field.  So "Column 1" would just become "1".
- Save the translated name in the data source config section of the session file, and use that translation regardless of what language the session is reopened in.
- Apologize that session files are not compatible between languages.

Other options that might be more desirable seem to require significant re-architecturing how data sources handle field names.

Thoughts?
Comment 7 Jonathan Liu 2017-02-03 21:24:47 UTC
I think the following would be desirable:
- Make the session file data the same regardless of the current Kst locale, could standardize on English
- Just because a German user creates a Kst session file without manually specifying labels, an English user opening the Kst session file shouldn't see automatic German labels but should see the corresponding automatic English labels
Comment 8 Netterfield 2017-02-03 21:30:14 UTC
Yes. 

This is the top of my list of options that  "might be more desirable" but 
"seem to require significant re-architecturing how data sources handle field 
names."

I am honestly not sure that this can be done without a pretty serious re-write 
:-(

On Friday, February 3, 2017 9:24:47 PM EST Jonathan Liu wrote:
> https://bugs.kde.org/show_bug.cgi?id=375612
> 
> --- Comment #7 from Jonathan Liu <net147@gmail.com> ---
> I think the following would be desirable:
> - Make the session file data the same regardless of the current Kst locale,
> could standardize on English
> - Just because a German user creates a Kst session file without manually
> specifying labels, an English user opening the Kst session file shouldn't
> see automatic German labels but should see the corresponding automatic
> English labels
Comment 9 Jonathan Liu 2017-02-03 21:36:42 UTC
How about having the default column names C1, C2, C3, etc.?
Comment 10 Jonathan Liu 2017-02-03 21:38:23 UTC
(In reply to Jonathan Liu from comment #9)
> How about having the default column names C1, C2, C3, etc.?

Of course we also need a fallback for compatibility with older session files.