[Potlatch-dev] #4010: i18n: make map_features i18n-ed

Hiroshi Miura miurahr at osmf.jp
Tue Sep 20 00:04:15 BST 2011


Hi TomH and developers,

Thank you comment.
Trac is not a discussion forum, so I move discussion on ml.

(2011年09月19日 18時01分45秒), OpenStreetMap wrote:
>
> #4010: i18n: make map_features i18n-ed
> -------------------------+--------------------------------------------------
> Reporter: miurahr | Owner: potlatch-dev@…
> Type: enhancement | Status: new
> Priority: minor | Milestone:
> Component: potlatch2 | Version:
> Keywords: |
> -------------------------+--------------------------------------------------
>
> Comment(by TomH):
>
> This is certainly needed, though there are various approaches to doing it.

Yes it is.
I consider pros and cons about 2 approaches.

approach 1. inject translated message using mechanism of babelFX.
approach 2. loading definition xml according to language.

pros.

for  1. - consistent approach.
     - localize contributer only see properties files.
   
for 2. - we can change features  menu according to language/region.
     - easy to maintain for localize contributers.
     - It can also use Flashvars passed on SWF loading.
       (To catch its value, I need to consume many hours but now realize
it:)
     - I have realized it:)

   about flashvar; see.
https://github.com/osmfj/potlatch2/commit/5e0d5f25bc69df3ddc8c86fd576fd7eb2989d6a3

cons.

 for 1. - difficulties for implement;  to inject we need unique 'id' for
each icons but now
     it is put with static mxml(TagViewer.mxml) using mx:repeater so
     it can NOT add unique 'id' to each icons.
 
     -because property key would be generated by some logic in above reason,
     programmers need to update  LocaleMap when map_features.xml updated.
     (It is totally boring work!!!!)

    - big problem: I have never realized it yet. :)

for 2.  - duplicate; all laungage need map_feature-<lang>.xml file that
may be equal other than
     tranlation.
      -- but that is not big problem because we can reduce size of
map_feature.xml file
     using include nested xml files.


>
> At one extreme the OSM web site could already do it by passing an
> appropriate parameter to the SWF based on what files are available, or we
> could do as your patch does and make the SWF do the job.

Both approach use it. no problem. This is NOT configured on XML but
SWF parameters.

>
> We may need to think about how this interacts with the resource bundling
> stuff, and whether we should actually be loading a zip named after the
> locale and then looking for map_features.xml inside it, along with the
> icons etc.
>

It is independent with resource bundling. As I wrote above. 

> I'm certainly not sure that we just want to duplicate the existing english

Not only duplicate. We may be able to reduce size that needed to
localize for minimum

> stylesheet to all the languages - it would be better to fallback to the

There are not stylesheet difference. It is top of definition files.
Many of icons, css and stylesheets  are common for all languages.

> english version somehow until there is a locale specific version. We may
> also want more granular fallback I guess but that's a hard problem I
> think.
>

This patch is not to make localized version but try to make i18n-ed scheme.
We share all of code in every languages and only switching configuration.


Please see here:

https://github.com/osmfj/potlatch2/blob/miurahr_i18n-features/resources/map_features/map_features-ja_JP.xml

category definitions and includes are language dependent.
only inputsets are duplicated.

Because it is common for all languages, we may be able to put it as
common includes xml file.

Next  is on each definitions.

https://github.com/osmfj/potlatch2/blob/miurahr_i18n-features/resources/map_features/shopping-ja_JP.xml

You pointed out many part is common for languages.
But I don't think so.

for example.

= current implementation.

<featureGroup>
  <feature name="super market">
    <category>shopping</category>
    <icon image="features/pois/shopping_supermarket.n.24.png">
      ${name}
    </icon>
    <help>http://wiki.openstreetmap.org/wiki/Tag:shop%3Dsupermarket</help>
    <point/>
    <area/>
    <tag k="shop" v="supermarket"/>
    <inputSet ref="names"/>
    <inputSet ref="web"/>
    <inputSet ref="buildingAddress"/>
    <inputSet ref="common"/>
  </feature> == how difference for languages

<featureGroup>
  <feature> <name="super market">  <name_ja="スーパーマーケット">
<name_de="....">
    <category>shopping</category><!-- this is 'id' of category -->
    <icon image="features/pois/shopping_supermarket.n.24.png">
      ${name}
    </icon>

    <icon image="features/pois/shopping_supermarket.n.24-ja.png">
      ${name_ja}
    </icon><!-- Some country use another icon for their renderer -->

    <help
lang="en_US">http://wiki.openstreetmap.org/wiki/Tag:shop%3Dsupermarket</help>


    <help lang="ja_JP">http://wiki.openstreetmap.org/wiki/Tag:JA:shop%3Dsupermarket</help>
<!-- help is localized wiki -->

    <point/>
    <area/>
    <tag k="shop" v="supermarket"/>
    <inputSet ref="names"/>
    <inputSet ref="web"/>
    <inputSet ref="buildingAddress"/>
    <inputSet ref="common"/><!-- totally common part -->
  </feature>

Common parts are not big share. we are only share inputSet as common
part. Spliting files for languages make translators easy to deal with.

Hiroshi

--
Hiroshi Miura
representative of OpenStreetMap Foundation Japan
sub leader of sinsai.info - Ushahidi4Japan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/potlatch-dev/attachments/20110920/6cd9cee9/attachment.html>


More information about the Potlatch-dev mailing list