androbey

Translatable image tags

Recommended Posts

Hello there,

I was wondering if it's possible to somehow translate image tags. 

Right now I have a page which outputs all images related to one tag in a single container (as there are many tags this results in various containers).

Every container has a title (and id) with the tag string, but currently only in the language of the entered tags.

Using the PW format inside the code like this does, of course, not work.. 

_x($variable,'translated Tag')

Is there a way to achieve this, without using workarounds (like extra fields)? 

Cheers,
Andreas

Share this post


Link to post
Share on other sites

What you're attempting seems too specific. It may be possible to hack the module to use a textLanguage field for tags instead of the simple text one, but that's a bad idea. You'll lose the ability to update the module, and may screw up the API.

I'd find another way around it, perhaps using a repeater to hold everything together. I can suggest 2 different approaches:

1. Alternative images field for the second language

If you have a field called "images", and another called "images_de", while having a second language with the name "de", the API will automatically use "images_de" if that's the user's language. This will automatically filter all your content.

Downside: You'll have to upload images twice. Not good if you want all images to appear on both languages, but then again I have come across the need to have images that appear on one language but not the other so...

2. Use a repeater to hold everything together

Set up a repeater, have a field for the image, and a textLanguage for the tags.

Downside: You'll have to code your own tags logic for whatever you're building in the frontend, and you'll have to upload images one by one.

 

You do make a good point. If the images field with language support gets different fields for description, I'd say the same should happen to tags as well. Maybe you should add this to the wishlist section of the forum.

Share this post


Link to post
Share on other sites

Hi @heldercervantes,

thanks for your reply.

I see and I was afraid to hear that. 

Personally, I wouldn't have a big problem using extra fields for that purpose, but it looses a lot of usability for the actual client using the feature. 

As I am using the build in API to find images based on tags (and the capabilities that comes along with that), it would mean a huge loss for my current implementation. 

Thanks also for the hint to add it to the feature request list. Will add it there. 

 

Share this post


Link to post
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


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By androbey
      I think it would be a great advantage for images to have an option to translate image tags, alongside the translatable description field (when using PWs language feature at all). 
      This feature could improve the multi language support in ProcessWire even further, thus the usability of it. 

      As a side effect that would also mean, that image tags could be easily used with the search engine, when dealing with a lot of images.