i18n: please don’t build sentences by concatenating substrings
-
Hi,
When checking some pending translation strings, I stumbled upon something you really should fix.if ( $is_maintenance ) { $this->_errors[ 'form' ][] = apply_filters( 'nf_maintenance_message', esc_html__( 'This form is currently undergoing maintenance. Please ', 'ninja-forms' ) . '<a href="' . $_SERVER[ 'HTTP_REFERER' ] . '">' . esc_html__( 'click here ', 'ninja-forms' ) . '</a>' . esc_html__( 'to reload the form and try again.', 'ninja-forms' ) ) ; $this->_respond();
What really should be ONE string (using printf()) has been broken into three separate strings. You even end two of those strings with space character, which usually will be missed by the translator since our translation platform translate.www.remarpro.com does not highlight this kind of “spurious spaces”.
Why you need to fix this:
1. There is not guarantee that the translator will see these strings in context and/or being connected to each other.
2. Some target languages may need to put things in a different order. In German, for instance, the main verb is often located at the end of the sentence.
3. Let’s say that a translator figures this all out, perhaps even translating “Please” into “Please reload the form by” and that way makes this sentence working. But then we will have a “bad translation” in our translation memory, where the string “Please” in some other places would suddenly run the risk of being translated incorrectly.It’s very possible that you have more cases like this. I just picked this as an example since I stumbled upon it.
If you’ve got any questions, you may comment here or ask in the “polyglots” channel in Slack.
- The topic ‘i18n: please don’t build sentences by concatenating substrings’ is closed to new replies.