Bug 307220

Summary: Wrong variable in YaST user management (String::RemoveShortcut)
Product: [openSUSE] openSUSE 10.3 Reporter: Kalman Kemenczy <kkemenczy>
Component: YaST2Assignee: Jiří Suchomel <jsuchome>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P3 - Medium CC: coolo, ke, locilka, mvidner
Version: Beta 2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Variable error in the YaST user mondule's help file
Different text in the help file vs. in radio buttons (comes from variables)

Description Kalman Kemenczy 2007-09-03 19:13:49 UTC
In the user.po fájl, the message #546 has a wrong variable association.

%1 should refers to the "Finished" button, but it looks like it refers to another one. In the Hungarian translation not all "Finished" translated to the same word.
In that case the help has a different button name.
Please see the attachment.

thanks
kalman
Comment 1 Kalman Kemenczy 2007-09-03 19:14:58 UTC
Created attachment 161567 [details]
Variable error in the YaST user mondule's help file
Comment 2 Jiri Srain 2007-09-04 05:52:32 UTC
The help texts do not reffer to individual widgets, but contain the texts repeated (it is not trivial to strip off the shortcut marker in some languages).

Karl, please, pass to the translator...
Comment 3 Kalman Kemenczy 2007-09-04 07:13:10 UTC
I am the translator, but I am not sure where this variable comes from. But the buton label and the helptext should be the same.
Comment 4 Karl Eichwalder 2007-09-10 15:35:13 UTC
In users.hu.po I see:

#. button label (without shortcut sign)
#: src/widgets.ycp:1003
msgid "Finish"
msgstr "Befejezés"

I do not know whether that's related, though.  Anyway, I do not really understand the problem.  If you do not use the label of the bottom right button modulo the shortcut marker, why using a variable assignment at all?
Comment 5 Jiri Srain 2007-09-11 08:33:23 UTC
This text is taken from base.hu.po (so that we don't translate the labels again and again):

#. Button label
#: library/modules/Label.ycp:65
msgid "&Finish"
msgstr "&Kész"

The text above you refer to is used only in the help text (since versions with "Next" and "Finish" exist)
Comment 6 Karl Eichwalder 2007-09-11 08:53:08 UTC
Complicate.  Does this mean, you must translate

#. button label (without shortcut sign)
#: src/widgets.ycp:1003
msgid "Finish"

as

msgstr "Kész"

because this is what gets pulled in automatically from "base"?  But then I do not understand why we do not use the button label literally.  If the translator must lookup the translation in base first, it is still error prone.
Comment 7 Jiri Srain 2007-09-11 09:38:46 UTC
Yes, it does.

In fact, we have the very same problem in every YaST module. In order to unify, we have the button labels in base.po, but the helps differ. In this case, the button is as a standalone text and inserted into the help message, in other cases it is a part of the help texts.

The only solution which would work in this regard is a functionality to remove the shortcut mark. Then we would be sure to use always the same translation, but otherwise I do not see any way.
Comment 8 Karl Eichwalder 2007-09-11 14:14:41 UTC
Ok.  I'd like you to improve the comment, maybe as follows (assuming that all the buttons are provided by base.pot):

#. button label (use the same translation as in 'base', but without
#. the shortcut sign)
#: src/widgets.ycp:1003
msgid "Finish"

And for 10.3 just let's hope the best.
Comment 9 Lukas Ocilka 2007-09-17 07:55:03 UTC
Anyway, maintainer of YaST Users module is jsuchome.
Jiri, please, see comment #8.
Comment 10 Jiří Suchomel 2007-09-17 08:24:25 UTC
What about introducing new set of functions, like Label::Finish, Label::Next, that would differ from the Label::FinishButton (Label::NextButton) only by missing shortcut? Than we can use variables also at these places. But of course, translator could translate differently those 2 texts ("Finish" vs "&Finish") even if both would be in the same file...

Removing shortcut sigh with deletechars function is probably no way to go, as it may fail for CJK languages - or am I wrong here?
Comment 11 Jiri Srain 2007-09-18 15:38:59 UTC
Yes, this may be a solution. Having the two texts translated very close to each other in the .pot-files should help.
Comment 12 Jiří Suchomel 2007-09-18 18:45:35 UTC
But now it is too late anyway.
Comment 13 Kalman Kemenczy 2007-09-26 07:55:37 UTC
Another example:

base.pot 
- message #56 
  #. help text for service auto start widget
  #. %1 and %2 are button labels
  #. %1 is eg. "On -- Start Service when Booting"
  #. %2 is eg. "Off -- Start Service Manually"
  #. (both without quotes)
  #: library/cwm/src/CWMServiceStart.ycp:196
  #, ycp-format

<p><b><big>Service Start</big></b><br>\n
To start the service every time your computer is booted, set\n
<b>%1</b>. Otherwise set <b>%2</b>.</p>

%1 and %2 variables not point to the label appears in modul.

This should point to firewall.pot
- messages #116 an #117

&Enable firewall automatic starting
&Disable firewall automatic starting


See atachment. Sorry this is Hungarian but you can see the differnces.

Comment 14 Kalman Kemenczy 2007-09-26 07:57:42 UTC
Created attachment 174771 [details]
Different text in the help file vs. in radio buttons (comes from variables)
Comment 16 Jiri Srain 2007-11-09 09:53:55 UTC
In the later case, both help text and the button text are part of one file. Unfortunately, there is no way to remove the shortcut mark from the button labels to use the string only once (it's problematic eg. for CJK languages). This is something translators must handle.

Karl, just to ensure there is no optimal solution, is there a function which is able to remove the shortcut mark from a string in all languages?
Comment 17 Karl Eichwalder 2007-11-09 10:50:44 UTC
I'm not aware of such a feature.  You probably mean at runtime, do you?  Or do you want to manipulate the .po translation files.  Concerning .po files, you could use a combination of msggrep | msgfilter, and then msgcat.
Comment 18 Jiri Srain 2007-11-09 11:31:58 UTC
Yes, I meant runtime.
Comment 19 Karl Eichwalder 2007-11-09 13:00:43 UTC
Such a function does not exist, AFAIK.

If you do not want to modify the standard gettext function, we could try to create dedicated translation file with all shortcuts remove and you could set the textdomain to this translation file if necessary.

I do not know how reliably this would work...
Comment 20 Jiri Srain 2007-12-03 14:41:23 UTC
Well, just an idea:

if (language is CJK, we can update the set as needed)
  s/ *(&[a-zA-Z]) *//
else
  s/&//

Do we have any other group of languages which need special handling? Even if we do, it may be feasible to handle them a special way. Do you think this may be a way to go?

The advantage: We get rid of similar inconsistencies forever if we find such way to generate labels for helps.
Comment 22 Karl Eichwalder 2008-01-31 02:45:44 UTC
Your approach looks fine.  I guess other script languages are also affected.  I'm going to ask on the o-translation ML.
Comment 23 Christoph Thiel 2008-04-25 12:45:09 UTC
Karl, *ping*
Comment 24 Karl Eichwalder 2008-04-25 13:08:11 UTC
According to the feedback I received, also Punjabi (pa) is affected:

From: Aman <apreet.alam@gmail.com>
Subject: Re: [opensuse-translation] About shortcuts (yast)
To: opensuse-translation@opensuse.org
Cc: Karl Eichwalder <ke@suse.de>
Date: Tue, 12 Feb 2008 12:00:22 +0530

Karl Eichwalder ਨੇ ਲਿਖਿਆ:
> In some modules it is possible to reuse button texts within the help
> texts.  The problem is to find a way to eliminate the shortcut
> denominators such as "&Ok" or "&Cancel" (note the ampersand).
>
> It is not that difficult with languages based on latin characters
> (French, Czech, Dutch, etc.).  But for Asian and other script based
> languages we must work out special routines.  Please, describe how you
> use shortcuts in your language; if you do it the English way, there is
> no need to send an e-mail, but if you use something such as follows
> (ja):
>
> #. Button label
> #: library/modules/Label.ycp:57
> msgid "&No"
> msgstr "いいえ (&N)"
>
> tell me about it.
>

for Punjabi, we are using like above, (keep
shortcut in English with () ).
Comment 25 Martin Vidner 2008-05-14 14:23:36 UTC
Comment 20: we should make that into "string String::RemoveShortcut(string)" (I must resist ShortcutCut or Longcut or Shortercut... ;-))
Comment 26 Jiri Srain 2009-01-06 11:19:31 UTC
I've added string String::RemoveShortcut(string); only in SVN trunk for now.

Jiri, please, update the users module's help texts to use the button labels through this function.
Comment 27 Jiří Suchomel 2009-01-06 13:29:10 UTC
Done in 2.18.1