How to translate an added tag in a theme

Hello !

I added a tag “Retour recherche” in my own theme. I’d like to translate it to “Retour à la recherche”.

How can I achieve this ?

Thank you.

When you say you added a tag in your own theme, what do you mean exactly? A tag like a tag for an item through Omeka’s Tag system? Or something else? Themes aren’t generally involved too much in that tag system.

Well, the word I used, “tag” is confusing.

<?php echo __('What I miscalled tag but is a msgid '); ?>

Is it more understandable like this ?

Thank you for helping me.

OK, a translatable string.

In your specific example it seemed like both the “source” and “translated” string were French. What’s the use case here, rather than just changing the string directly?

If you do want to use the translation system though, a theme can load its own translations, using the add_translation_source function. Typically you’d call this from your theme’s custom.php file. Then you just need a folder in your theme that contains .mo files with the translations you want to support (typically this folder is called “languages”). You pass the path to that folder to add_translation_source.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.