Translate Test Cases Strings should be LOWER PRIORITY than other UI strings.
I did a quick analysis of translatable strings in Test Cases (*Test.php). Drupal 8 has about 35xx strings. Remove the duplicated strings in non-testcases files, I think there's about 500 ~ 2000 strings. Usually, only senior developers would access Tests modules. As my own experiences, I even won't read the failing test messages and debugging / find out the problem in source code directly.
We should find a way to filter / mark these strings in Translation UI to help translator make decision.
** Remember that it also apply to all modules, not only the CORE. There're can be 10,000 test cases strings.
Comments
Comment #2
droplet commentedComment #3
gábor hojtsyThe localization server does not have a concept of prioritized strings vs. other strings, so to solve this that way would be quite a stretch.
Why do tests translate strings that do not otherwise show up on the Drupal UI as translated to begin with? Things like getInfo(), assert messages, etc. are not supposed to be translated. The coding standards at https://www.drupal.org/node/325974 for some reason do not explain the assert messages convention but it does the getInfo().
Can you list representative examples of those 500 - 2000 strings (that is a pretty wide range?).
Comment #4
droplet commentedIt would shown up on UI but an icon or whatever marked it as Test Case Strings.
Sorry. I'd do more deeply analysis soon but if it's banned at beginning. I'm better to save my time to do more translation instead. We have very limited resources. I trying anything can max our efforts.
Comment #5
gábor hojtsyTest cases should not have translatable strings which are not showing up in Drupal code itself (outside of tests). Implementing this feature on the localization server side is not the solution. Why are tests using such strings, care to answer my question?
Comment #6
droplet commentedIt's a good question. If so why to show it in Translation UI ?
Comment #7
droplet commentedOnly exist in Test Case
Also in other UI
Comment #8
droplet commentedAssumed that ALL should not be translatable strings. Even Core Development we have reviewers & committer to scan every patches we missed it. Shouldn't we do something for contributed modules also ?
Comment #9
gábor hojtsyThis is a great example. Whatever it asserts would ALSO be t()-ed in Drupal itself, that is what is being tested after all. The assert message 'Translations found' however is not translated. Not seeing anything in this example or the other example you posted that is not t()-ing things that should already be t()-ed in Drupal's code.
Looking at the concrete strings, these do seem to be not testing what Drupal actually generates:
The right source string to use in the test would be t('Updates for @module_list') NOT t('Updates for: @modules') or t('Updates for: @project'). The next one:
Where it tests t('@post %title has been created.') or t('Basic page %title has been created.') all of those are wrong and should be t('@type %title has been created.') based on the similar string that is actually output.
The only reason the wrong assertions pass is we don't run the tests translated :) Given the source strings are different, they would not pass with translations that may be different.
These need to be resolved in core, these are testing bugs.
Comment #10
gábor hojtsyFor the RSS examples, they indeed come from test modules, I would argue the test module should not t() the source either, unless it needs to test the translation. For the last one, that is as your snippet shows too, comes from Drupal's node type list builder, so not test only either:
Comment #11
droplet commentedOK. Get some more info. It's much less than my assumption. After deduplication, there're less than 225 strings. At this level, it's more suitable to do something in Coder-like modules instead.
(So in other hand, we may have 225 trivial bugs / untidy code in CORE)
Thanks ALL.
Comment #12
gábor hojtsy@droplet: it would be a great meta issue to crowd-source :)
Comment #13
gábor hojtsySo I made up my mind because I heard this from several more people. Also apparently we already try to avoid parsing tests. We exclude the ..../tests/... directories, so test modules are not included. See https://localize.drupal.org/translate/projects/drupal/releases/454190 there are no such files parsed. However, there are 1550 files that are ..../Tests/.... (note case difference). Those are the actual tests. We should exclude those too probably. Not sure of the overall impact of them, but I made up my mind about making people work on those. Why would they. You are right. I was wrong.
Comment #15
gábor hojtsyComment #18
gábor hojtsyOk committed. Now deploying to drupal.org.
Comment #19
gábor hojtsyOk this got rid of 496 strings. Not a small feat to avoid people working on things they will not need. Ideally tests would only ever use strings that exist on the frontend only, but its clear that tests also use test modules and strings from there, as well as several bogus strings.
Comment #20
droplet commentedGreat! Thanks!