[Yanel-dev] Language version API

Michael Wechner michael.wechner at wyona.com
Mon Apr 2 16:01:50 CEST 2007


Josias Thöny wrote:

> Hi,
>
> Michi proposed to store the information about language versions as 
> follows in the resource configuration:
>
> <yanel:property name="language" value="de"/>
>
> <yanel:custom-config 
> xmlns:xr="http://www.wyona.org/yanel/resource/xml-resource/1.0">
>   <xr:alternative-languages>
>     <xr:alternative-language lang="en" href="/about_en.html"/>
>     <xr:alternative-language lang="es" href="/es/acerca.html"/>
>   </xr:alternative-languages>
> </yanel:custom-config>


well, that would be one way of implementing it, but I guess it's not so 
good, because with more than 2  languages a lot
of information would be duplicated

>
>
> Now the question is how to make this accessible in java. Maybe we 
> could introduce a "Translatable" interface for resources which support 
> multiple language versions:
>
> interface Translatable {


what about calling the interface something like "I18nable"?

>     String getLanguage();


don't we have this method already within one of the other interfaces and 
hence will lead to problems when mixing?

>     String[] getLanguages();


I guess this will return all languages, I mean including the one from 
which this method is being called, right?
Otherwise it probably should be called getAlternativeLanguages()

>
>     Resource getTranslation(String language);


I guess this method could be used to figure out the path

getTraslation(String language).getPath() right?

>     void addTranslation(Resource resource, String language);


wouldn't we have to add a path here?

>     void removeTranslation(String language);
>     boolean hasTranslation(String language);
> }
>
> WDYT?


sounds good to me, whereas I would consider another implementation ;-)

Thanks

Michi

>
> josias
>
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner at wyona.com                        michi at apache.org
+41 44 272 91 61




More information about the Yanel-development mailing list