URL:
  <http://gna.org/patch/?1154>

                 Summary: Enabling localization of images
                 Project: Battle for Wesnoth
            Submitted by: caslav_ilic
            Submitted on: Sunday 04/05/2009 at 22:46
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

This is the patch to support localizing images (e.g. having maps with
translated labels) on the code side. The discussion of the overall concept
was in this thread:

http://www.wesnoth.org/forum/viewtopic.php?t=16721

where torangan has given go-ahead for the concept in this message:

http://www.wesnoth.org/forum/viewtopic.php?p=290107#p290107

and also ivanovic, on IRC:

http://wesnoth.org/irclogs/2009/04/%23wesnoth-dev.2009-04-05.log (from
20:39:50 to 21:15:40)

The patch has two stages:

For each file foo/bar/baz.xyz fetched by get_binary_file_location() in
src/filesystem.cpp, it is simply tested if foo/bar/l10n/LANG/baz.xyz exists
(where LANG is language code), and if it does, its path is returned instead
that of the original file. This is only 5 extra lines of code, and would be
the end of story, if not for the following.

Some images are very big compared to the text on them that needs to be
translated. E.g. current five maps based on the main map of Wesnoth together
take about 10 MB, so if ten languages would localize them, it would amount to
100 MB, or near 50% increase of tarball size. On the other hand, if only the
areas around translated labels are cut out into a largely transparent PNG,
and overlayed at runtime over the original map, the size reduction per map is
greater than factor 10. Therefore the new add_localized_overlay() function in
src/image.cpp, which looks for overlay cut as foo/bar/l10n/LANG/baz--ovr.xyz,
and if found, loads and combines it with original bitmap previously loaded.
(Of course, only unless a standalone localized image was found in the first
place, which is checked for in load_image_file() by looking for "l10n" in the
path returned by get_binary_file_location().)

The patch was made and tested for 1.6, and as of now applies cleanly to trunk
too.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sunday 04/05/2009 at 22:46  Name: wesnoth-loc-img-06.diff  Size: 3kB  
By: caslav_ilic

<http://gna.org/patch/download.php?file_id=5575>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1154>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to