Repository navigation
Description
Summary
describe translations prints a source string that contains CRLF line breaks with LF only. Running the same file
back through create or modify translations then reports the entry as unknown, and the text stays empty:
No text has "{1} days\n" as its source, and nothing carries this de_CH translation,
so there is no telling where it went. The text may have been deleted, or the key may be a typo.
The same entry written with the CR kept inside the quoted string ('{1} days\r\n', a raw CR byte in the file) is
matched and written. So matching itself is exact and works; the round trip from describe to create loses the CR.
Why it matters
Texts with CRLF come with Marketplace modules. In a scratch app with WorkflowCommons 4.10.0 there are 12 texts with
a CRLF source and no de_CH text, 9 unique strings (by text: 6 in WorkflowCommons, 1 in FeedbackModule 4.0.2, 5 in
Atlas_Web_Content templates). Three of them are confirmation questions, for example "Are you sure you would like to withdraw this
workflow?\r\n\r\nThis means ...".
In an app whose default language is not English, those confirmation questions are CE4899 errors ("Empty question.
[German, Switzerland]") until they have a default-language text. The documented describe -> fill -> create workflow
(the translations skill) leaves exactly those errors behind.
Reproduce (mxcli v0.32.0, Mendix 11.12.1)
- Use an app with WorkflowCommons 4.10.0, default language de_CH, languages en_US and de_CH. The module's texts are
en_US only. alter settings LANGUAGE (DefaultLanguageCode: 'en_US');(describe and create are keyed on the default language:
A Marketplace module that ships no texts in the app's default language: 99 CE4899, anddescribe/create translationscannot fill them #1887).describe translations in WorkflowCommons for de_CH. The entry for the dynamic text "{1} days\r\n" is printed
as follows (od -cof the output):There is no' { 1 } d a y s \n ' a s ' ' ,\r. The model has{1} days\r\n(Texts$Translation.Text in the unit's BSON).- Fill in a translation and run the file with
create or modify translations in WorkflowCommons for de_CH (...).- The message above is printed for every CRLF source in the file.
mx checkstill lists the 3 CE4899 on the confirmation questions.
- Write the same entry with the CR kept, as
'{1} days<CR><LF>' as '{1} Tage<CR><LF>'with raw bytes in the file.- It lands: both texts with that source get
{1} Tage\r\n. - In a full run with the CR kept for all of them,
mx checkgoes from 99 CE4899 to 0.
- It lands: both texts with that source get
Expected
The output of describe translations can be run again as it is. Any of these would do:
- keep the CR in the quoted string, as create accepts it;
- write an escape that create reads back (
\r\n); - have create treat CRLF and LF as the same when it matches a source.
The third also helps files written by hand or by an agent, which write LF.
Related
- A Marketplace module that ships no texts in the app's default language: 99 CE4899, and
describe/create translationscannot fill them #1887: describe and create translations are keyed on the default language, so a default-language gap can only be
read and filled by switching the default.
Measured on v0.32.0 only; the only commit on main since v0.32.0 that touches translations (#2327, show message translations on an in-place edit) does not change describe or create translations.
Activity