How to translate a theme - Again!

I did all of the translations for my language. I have a .mo file in the Omeka/application/languages directory. In a previous Forum question regarding translation of a theme, someone gave instructions "you need to be calling add_translation_source in your theme’s custom.php. For someone who is new to Omeka, can someone please tell me exactly how to call this this in a custom.php file that I create. I need the exact php code.
Thanks very much.

Are you translating Omeka itself into a new language, or are you translating the unique extra strings from a theme? Your title and the except about add_translation_source point toward this being a theme, but your mention of having a .mo file in the application/languages directory points toward translating the Omeka core.

I translated the Omeka core. It’s in the /application/languages directory. I need a translation of a theme/themes. As I stated in my original posting, someone (thiebault moobee) previously gave instructions that to translate the theme all I need is to call add_translation_source in the theme’s custom.php. Howver, not all of the themes have a custom.php file included. My question is, after I create a new custom.php file for the theme, I don’t know what the php script looks like for calling the .mo translation file in the /application/languages directory

So, are you saying that the strings the theme uses are already translated in the .mo file that you have in application/languages?

If so, they should already be being used, if you have that language selected in the configuration file. Omeka looks at all translations as one big group, so if the translation file in the core has a translation for a given string, it will be used, even if the string is being used in a theme.

If things are not being translated, it may just be that the theme is not written for translation. In Omeka Classic, for strings to be translatable, they have to be passed through a call to the __() function (that’s two underscores). If your theme is just using bare strings then that’s the issue here.

You say “Omeka looks at all translations as one big group, so if the translation file in the core has a translation for a given string, it will be used, even if the string is being used in a theme.” So, that means I don’t need to have a separate translation file for a theme, since each theme uses the the translation file in the core. My next question is, what is the purpose/use of Translations plugin? In the details for the Translations plugin I read " This plugin works the same, but you can add any strings yourself either in the directory languages/ of the current theme, either in the directory languages/ of this plugin, so they will be translated in Omeka." So, if I can include a translation string in the core translation file, why would I need to add any string in the Translations plugin?

I’m not familiar with the Translations plugin, but it looks like what it does is just add some extra places you can put translation files: in the “languages” directory of that plugin and in the “languages” directory of the current theme (assuming the theme doesn’t have that enabled already).

As for why you might want to do that: its often easier to manage extra content in plugins or themes rather than editing or adding files to the core. If you’re already adding a new .mo file then it might not be much of a factor, though.

I guess the reason is that, if you added your custom translation via the .mo file in the core, it would get overwritten when you update Omeka; while, if you added custom strings at a (custom) theme level, you would not risk such an issue.

Besides, those changes could be related to your specific theme: for instance, for one installation I’ve forked and customized the Thanks, Roy theme, adding new bits and links; those texts sometime alter the original theme’s or even core’s ones, and have to be translated into the site’s languages (in this specific case, Italian and Esperanto); the best way to do it is to add them at theme’s level.

Hope this helps.