OnlineCop / kq-fork

Fork of KQ r910. Just for fun.
GNU General Public License v2.0
15 stars 9 forks source link

Localization: Not always possible? #152

Open OnlineCop opened 2 years ago

OnlineCop commented 2 years ago

When you go to equip a player, there are four options across the top: Equip, Optimize, Remove and Empty.

The rectangles drawn around them are very precise (barely fit around "Optimize"), and localized text which exceeds about 8 letters long will draw outside of that area.

I'm fine with dynamic text, such as that found within Lua dialogue, being wrapped in the gettext.h _("...") macro, but I wonder whether we should forego text within menus from the same translation?

z9484 commented 2 years ago

Too bad gettext doesn't have a way to add comments like this field needs to be abbreviated if more than 8 letters. I would probably say keep it translated and hope the translators try it out first?

OnlineCop commented 2 years ago

I increased the text for the "Equip", "Optimize", "Remove" and "Empty" menus (each of them appends the text "Everything" for this example) and played around with some dynamic menu adjusting:

image

There are two parts to this:

  1. The inactive text is chopped off after 8 characters (red circled areas in the screenshots), and
  2. The active menu option (the one with the solid grey background) widens to fit the text and shifts (if needed) to avoid spilling over the right edge:

image

I'm still looking into this, but it requires changes in several places because localized text on the other sections, like items (red, below) and status (blue, below) will spill over:

image

OnlineCop commented 2 years ago

The above work has convinced me that our fonts need to include an ellipsis (a ... character) so overflowing text can at least indicate as such.

Does anyone know how the fonts (fonts.png) were generated?

z9484 commented 2 years ago

I'm pretty sure its just manually created. It would probably work if we added to glyph_lookup https://github.com/OnlineCop/kq-fork/blob/road_to_1.0/src/draw.cpp#L73 and added in a ellipsis character to fonts.png The accented characters at the end of fonts.png do not appear to be following the ascii order so its kind of a puzzle.

z9484 commented 1 year ago

I finally got it to work to add … feature/add_ellipsis Though I can't say I implemented it correctly, I did a hard coded match overwriting asci 254 instead of taking the time to figuring out all the proper unicode decoding and bit manipulation.

z9484 commented 1 year ago

Is this issue ready to be closed?

OnlineCop commented 1 year ago

154 fixed a single menu; I don't know whether we want to keep this open as a Story with multiple sub-components, or count it as complete for now, and reopen once the remainder of the menus get overhauls.