Mailinglist Archive: yast-devel (61 mails)

< Previous Next >
Re: [yast-devel] Idea: Dynamic Folding of Translated Texts
Dne 12.5.2016 v 08:49 Lukas Ocilka napsal(a):
# Example

----------------------------------------------------------------------
You are trying to create subvolume {new_subvolume_name} which would be
shadowed by subvolume {old_subvolume_name} and thus might not produce
the desired effect. Continue despite the fact that we have warned you?
----------------------------------------------------------------------

In bad the example above, subvolumes can be short, but they can be also
very long. Some languages will use very long translation, some other
ones a shorter one.

My workaround is to put the variable text on a separate line to avoid text
overflow, e.g [1]:

# %s is an extension name, e.g. "SUSE Linux Enterprise Software Development
Kit"
Yast::Report.Error(_("Downloading the license for\n%s\nfailed.") %
addon.label)

This workaround makes sense when the text is usually long. When the variable
text is short then it looks ugly.

# Solution

Basically something like `fold`, but implemented in Ruby without calling
shell. Maybe in Yast::String, maybe even as a Yast built-in (fold, wrap,
wrap_at).

Actually this should be implemented on the UI level as only the UI can know how
much space there is and how long text can fit there.

Moreover in Qt we use proportional font, that means "iiiiiiiiiiiiiiiiii"
might fit while "mmmmmmmmmmmmmmmmmm" might not even though both have the
exactly same number of characters. And I guess with non-Latin alphabets (Arabic,
Japanese, ...) it would break very easily...

The implementation at the YaST logic layer would not work well in many cases,
IMHO that's a wrong place for this functionality.


# Solution 2

My suggestion would be to add Opt(:wrap) option to the Label() widget which
would enable the line wrapping. The text would be a single line and the UI
would take care of breaking the lines at the appropriate places. Example:

Label(Opt(:wrap), "verlongtext" * 42)


What do you think about it?



[1]
https://github.com/yast/yast-registration/blob/master/src/lib/registration/ui/addon_eula_dialog.rb#L87

--

Ladislav Slezák
Appliance department / YaST Developer
Lihovarská 1060/12
190 00 Prague 9 / Czech Republic
tel: +420 284 028 960
lslezak@xxxxxxxx
SUSE
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
References