symphonycms2-extensions / gettext

Add parameters for multilingual static resources
3 stars 0 forks source link

Default i10n name.properties file not picked up #15

Closed davidhund closed 12 years ago

davidhund commented 12 years ago

You state that the fallback (default) .properties file should apply.

"Default language file: 'name.properties'"

This does not seem to work. I have a ecm.nl_NL.properties file which is picked up but ecm.properties is not.

remie commented 12 years ago

@davidhund:

The default properties are added to the datasource without any regionCode or languageCode.

<resources type="i18n">
    <resource regionCode="nl-NL" languageCode="nl" countryCode="NL">
      <item name="string">Dit is een i18n JAVA test</item>
    </resource>
    <resource regionCode="" languageCode="" countryCode="">
      <item name="string">This is an i18n JAVA test</item>
    </resource>
</resources>

This allows you to have control over whether the default value is applicable. So in your page, you should add checks to see if a localized resource is available, and if not, you can refer to the default if appropriate.

So this is not really a bug, but a feature of the extension. I guess your question is if it is possible to also add the logic of selecting the default in the extension datasource so that you will always have a value for your item instead of having to add logic in your view, is that correct?

davidhund commented 12 years ago

Thanks Remie. I'll look into it when I can (away from source-code a.t.m. ;) ).

My question was indeed about having that logic in the extension but if it does work as you say adding the logic in my templates would work, only slightly less elegant ;) Thx.