Thomas Detoux napisaƂ(a):
Hello all,

My point is to show different versions of a picture for different
values of the users' locale, this will help for any picture with text
in it.

The first path explored was to have different picture for each locale :
* my_picture_en.jpg
* my_picture_fr.jpg

and to have sitemap replace a reference to /my_picture.jpg/ to the
correct localized version.
In order to reduce the number of images nedded, only the language part
of the locale is desired.

The org.apache.cocoon.matching.LocaleMatcher documentation indicated
that, among others, a *langage variable* was available within the
matcher, so I tried this :
Which documentation? Apidocs?
You should know that I've never used LocaleMatcher but I'll try to help you.

========== BEGIN SITEMAP.XMAP SNAPSHOT ==============
[...]

<map:matcher logger="sitemap.matcher.locale" name="i18n"
src="org.apache.cocoon.matching.LocaleMatcher">
<locale-attribute>locale</locale-attribute>
<use-locale>true</use-locale>
<default-locale language="fr"/>
<create-session>false</create-session>
<store-in-request>true</store-in-request>
<store-in-session>false</store-in-session>
<store-in-cookie>false</store-in-cookie>

I think you should also put <negotiate>true</negotiate>.
<map:match pattern="**/images/*.gif">
<map:match type="i18n">
<map:read mime-type="image/gif"
src="{system-property:site.home}/images/{2}_{language}.gif"/>
</map:match>
</map:match>

[...]
================END OF SNAPSHOT=============
Where is pattern attribute of inner matcher?
I think it should be done that way:
<map:match pattern="**/images/*.gif">
<map:match type="i18n" pattern="{system-property:site.home}/images/{2}_*.gif">
<map:read mime-type="image/gif" src="{source}"/>
</map:match>
</map:match>

The reason is that matcher tries to find _existing_ resource by trying different locales so it has to know the pattern path for the resources.


Unfortunately, that doesn't work, server log sys :

(date) DEBUG [net.sf.ehcache.store.MemoryStore] cocoon-ehcache-1Cache:
MemoryStore miss for
PK_R-resource-file:/path/to/images/my_picture_.gif

As you can see, the /language/ is missing to the filename. When I try
to switch the two map:match, the log indicate that the server is
trying to reach file named *_en.gif* or *_fr.gif*.

Where is my mistake ? what's wrong ? Is there a better way to
internationalize pictures ?

Hope that helps.

--
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to