After installing the contributed module, the detection of translation strings is unstable when translating with interface translation.
I can't find the translation string.

I have confirmed that the string is there in localize.drupal.org, also manually update the translation files.
Sometimes I can't figure out the cause, leave it for a few days, and then it is detected when I forget about it.
Also, there are times when you can't detect and find it even after waiting for a while.

Why is the detection of translation strings unstable?
What can I do to solve this kind of problem?

Thank you.

Comments

vm’s picture

cache issue?

s-jack’s picture

I have cleared the cache many times.

pobster’s picture

Now ... I know this is true for D7, and TBH ... I'd imagine it's the same for D8 too, I'm just not 100% sure but it's likely, so I'm going to say it anyway.

Files aren't scanned for translation strings, they're only inserted into the translation system when the page they're on is viewed.  So ... you won't see a translation string in the UI until you've been on a page which utilises it.  That's why it feels "unstable" - it's reliant on web traffic unless you render the page yourself.

s-jack’s picture

pobstar, I'm sorry for my poor explanation.
Detection is not the display of the translation string in the content, but the detection in the interface translation screen.
When translating strings in the UI, some of the translated strings are not displayed.

vm’s picture

I don't think pobster is saying it's only related to content but every where t() strings are used.

pobster’s picture

Yes, this is correct.  As files are not scanned for their usage of t() strings, the only way to get them into the database and available in the translation interface is when they're viewed on whichever page they're utilised on.  This then triggers the write, where the t() says "do I have a translation for this string?" and it's only at this point that it becomes available in the translation UI page because this is the point where it's stored.

s-jack’s picture

Hi, VM and pobster.
Thanks for the detailed explanation, I fully understand.

I will try it by displaying the page where the string is used.

There is one problem I am having.
I'm testing the change request module, but there are statuses in the select list, and I can't translate these.
The values in these lists have been verified by localize.drupal to be translation strings.
Is it because the selection list is only visible in the admin pages?

gogowitsch’s picture

I suspect once the config exists, it can only be translated as part of the config, not via the User interface translation page (/admin/config/regional/translate).

You can enable the Configuration Translation module (config_translation) and visit its page at /admin/config/regional/config-translation.