Jump to content

Best way to deal with multilingual images that are optional


joe_g
 Share

Recommended Posts

Hey experts, I ran into this today:

A client has a site with lots of languages (12). I just learned about multilingual fields where any field can become multilingual, which is great. My problem is that I don't know what languages the client want to make language-specific images for.

In most cases the default images-field is fine, but sometimes there is a secondary language (in this case Spanish). Is there a way I can allow the client to add a language to a multilanguage field? Perhaps a combo of repeater and images field, or some sort?

I suppose I could create a version for every language. The drawback is that I would have to remember to update this field in parallel with the real languages. If the client adds polish tomorrow, I would have to add a polish alternative version of these images. It's not the end of the world, and that is probably what I will end up doing, just curious if there is more neat way?

thanks!

 

Link to comment
Share on other sites

On 12/17/2024 at 4:31 PM, joe_g said:

In most cases the default images-field is fine, but sometimes there is a secondary language (in this case Spanish). Is there a way I can allow the client to add a language to a multilanguage field?

I didn't play with multilanguage image fields, but if it's the same behavior than with other multilanguage fields (probably) you have nothing to do: if a multilanguage field defines a value for the current user language, then this value is used, otherwise the default language value is used.

EDIT : hmm, looks like there's no multilanguage image field, so language alternate fields looks like the only solution, and then a hook like @ngrmm proposed sounds good.

Edited by da²
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

hi,

in a two languages website, of course i would use two fields and use the specific one if filled, in your case i would probably tend to use a naming convention with _iso for each languageexecpt for the default one, this way, parsing your fields, it's easy to check if toto_pl.jpg exisits, if not, just use toto_jpg, it would work for any language number and, as it's easy to retreive the used languuages iso even if your client suddenly decides to add a new one

and more, give your client the good habit to get used to naming convention 🙂

have a nice day

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...