Not all units in the Object Transform dialog are translatable

Bug #666370 reported by Kris
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Fernando Lucchesi

Bug Description

The units for the angle in the Object > Transform dialog are not translatable. The "deg" unit in the tabs Rotate and Skew is different in at least a couple of languages, but simultaneously "rad" should also be made translatable.
I tried working on this, but failed in fixing the issue.

Tags: translation ui
Kris (kris-degussem)
Changed in inkscape:
importance: Undecided → Low
milestone: none → 0.49
Revision history for this message
jazzynico (jazzynico) wrote :

Instead of translating it, deg could be replaced with ° (which is the unit symbol for degrees that us accepted by the International System of Units). rad for radians is correct.

Changed in inkscape:
status: New → Confirmed
tags: added: ui
tags: added: translation
Revision history for this message
Fernando Lucchesi (fernandolbastos) wrote :

It took me a while to notice that the units are located on share/units.[xml|txt], instead of the src folder, but after finding it, it was only a matter of replacing "deg" to "°" and checking if anything broke.

Actually it did break Rotate(which was odd, since Skew still worked), so I replaced all occurrences of "deg" on the codebase, which seems to have fixed it.

So, here's the patch.

Revision history for this message
Johan Engelen (johanengelen) wrote :

I am not sure whether the change in units.txt is good. The abbreviated unit name is used in the code to obtain a value from a spinbox or preference in the correct unit. For example:
      double deg_angle = _spin_angle.getValue("deg");
(_spin_angle is the spinbox for the angle in the guideline dialog).

It would be quite annoying for programmers if this no longer works, and one would have to look up how to write the °.

Are other units translatable?

Revision history for this message
Johan Engelen (johanengelen) wrote :

Making the units translatable in these dropdown boxes will be some work. It will involve /src/ui/widget/unit-menu.cpp. The use of UnitMenu relies on the text being *untranslated*; more precisely, the "get_active_text()" method of the used ComboBox should return the text untranslated. I think it is possible to use a modified ComboBox that shows a translated text in the UI, but also keeps an untranslated text for the get_active_text() method.
For exampe, have a look at how this is done for the language preference, see
"UI::Widget::PrefCombo _ui_languages" in inkscape-preferences.h, and see /ui/widget/preference-widget.
UnitMenu should be changed accordingly.

Revision history for this message
Fernando Lucchesi (fernandolbastos) wrote :

Perhaps there could be a constant DEG with value "°"(on utils/units.h or maybe somewhere else). That would solve the problem for programmers:
      double deg_angle = _spin_angle.getValue(DEG);

If that's not a good solution I'll work on the translatable version.

Revision history for this message
Johan Engelen (johanengelen) wrote : Re: [Bug 666370] Re: Not all units in the Object Transform dialog are translatable

On 17-4-2011 23:52, Fernando Lucchesi Bastos Jurema wrote:
> Perhaps there could be a constant DEG with value "°"(on utils/units.h or maybe somewhere else). That would solve the problem for programmers:
> double deg_angle = _spin_angle.getValue(DEG);
>
> If that's not a good solution I'll work on the translatable version.

Maybe I am whining too much; the programmer issue is a bit dumb, sorry
for bringing that up. (a #define DEG "º" maybe nice though yeah, add it
in units.h)
But I am also worried a bit that I wouldn't have recognized the symbol
in Inkscape...
Otoh, maybe I'll try and get the unit to display inside the widget (like
the zoom entry box, bottomright), and then it would look much nicer to
have the °.

Note: ASCII defines two ° thingies: 248 ° and 167 º. Which one do you
want to take?

Revision history for this message
jazzynico (jazzynico) wrote :

According to <http://www.theasciicode.com.ar/ascii-table-codes/ascii-codes-248.html>, the degree symbol is 248 (167 is the masculine ordinal indicator).

Revision history for this message
Fernando Lucchesi (fernandolbastos) wrote :

I double checked, and I had used the 248 symbol (there was a short description on gnome character map, so I didn't pick the wrong one).

I've included the constant on units.h

Revision history for this message
Felipe "Juca" Sanches (felipe-sanches) wrote :

You gotta be careful because I think "deg" is a CSS3 unit prefix. You should not change the CSS parsing routines.

Revision history for this message
Felipe "Juca" Sanches (felipe-sanches) wrote :
Revision history for this message
Fernando Lucchesi (fernandolbastos) wrote :

I'm sorry, I didn't realize that. I've reverted the changes to cssreader.cpp.

jazzynico (jazzynico)
Changed in inkscape:
assignee: nobody → Fernando Lucchesi (fernandolbastos)
status: Confirmed → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Tested on Windows XP, Inkscape revision 11098.
Looks good, no obvious regression.

Thanks Fernando!

Revision history for this message
jazzynico (jazzynico) wrote :

Patch committed, revision 11116.

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
Clayton Walker (clayton.walker) wrote :

Personally, I think the deg symbol "°" just looks weird. Like there was some sort of odd internationalization error.

I vote for a change back to Degrees/Radians.

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.