Background of the issue:
I am trying to resolve an issue where one of our archive pages for a custom post type is not loading string translations. I have used the Query Monitor plugin and found that the text domain is not being loaded for that archive page, unlike others. I have scanned the theme for strings and confirmed that the post type is marked as translatable. Some strings are the same between the working and non-working pages, e.g., __('Category:', 'my-child-theme'). The issue is only appearing in our production environment.
Symptoms:
The text domain is not being loaded for a specific archive page, resulting in text remaining in the original language (English) instead of being translated.
Questions:
Why is the text domain not being loaded for the specific archive page?
What can be done to ensure the text domain is loaded and translations are applied?
I've done some further investigation and found that when I add an mo file for the theme into the wp-content/languages/themes directory then WPML seems to realise that it should inject the string translations and then overrides what is in the MO file. This isn't a fix as I might as well not use WPML for this if I have to put an MO file in.
Thanks. Because manually adding an mo file fixed the issue I'm unable to confirm your steps also fix is. Is this a known issue and what you've provided is a known fix?