[Yanel-dev] Language version API

Josias Thöny josias.thoeny at wyona.com
Tue Apr 3 00:20:41 CEST 2007


Michael Wechner wrote:
> 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

That's right. And considering that there might be other config/meta data 
common to all language versions, I'd prefer to have an additional common 
file for this purpose.
But I have no idea how to do this in the framework...

> 
>>
>>
>> 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"?

Personally I prefer Translatable to I18nable, because I associate i18n 
with translation of the application, not of the content.
But it doesn't matter that much to me.

> 
>>     String getLanguage();
> 
> 
> don't we have this method already within one of the other interfaces and 
> hence will lead to problems when mixing?

I could not find this method in any of the existing interfaces.

> 
>>     String[] getLanguages();
> 
> 
> I guess this will return all languages, I mean including the one from 
> which this method is being called, right?

That's what I meant.

> 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?

yes.

> 
>>     void addTranslation(Resource resource, String language);
> 
> 
> wouldn't we have to add a path here?

The path is part of the resource parameter.
Maybe it would be sufficient to pass just the path instead of the 
resource, I don't know.

josias

> 
>>     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
>>
> 
> 




More information about the Yanel-development mailing list