$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: true, vro: true, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
avatar image
Former Member

string templates and text elements / translation ?

Hi all,

in a normal se38 report one could write someting like

/ 'I have '(t01) && two && ' eyes.'(t02), "I have2 eyes.  <-- wrong spacing  
/ `I have ` && two && ` eyes.`,  "I have 2 eyes. <-- ok  
/ |I have | && two && | eyes.|.  "I have 2 eyes. <-- ok

The two text symbols T01 and T02 can be translated. But I would like to use string templates because I don't want to care about trailing spaces. You can not use text symbols with string templates as far as I know.

It results in a syntax error:

/ `I have `(t01) && ... <-- Syntax error
/ |I have |(t01) && ... <-- Syntax error

Without text elements the Code Inspector complains (informational): "Strings without text elements are not translated."

Is this crippled by design? Am I missing something?

BTW: I know CONCATENATE and pragmas and a few other ways to work around. That's not the question.

Add comment
10|10000 characters needed characters exceeded

  • Just to note that using text elements to construct sentences like

    'I have '(t01)&& two &&' eyes.'(t02)

    is not a good idea, as word order varies from language to language. OK, for this sentence, it works at least in French and German, but you'd get problems with

    You must check the table table_name

    Since the German would be: Sie müssen die Tabelle table_name kontrollieren.

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 21, 2017 at 02:37 PM

    What about embedded expressions inside string templates? These work as desired.

    |{ 'I have'(t01) } |
    |{ text-t01 } |
    Add comment
    10|10000 characters needed characters exceeded

    • "But it's hidden in what i thougt was syntax"

      Without embeddeed expressions in { ... }, string templates are simply a kind of string literals |...| where blanks (and especially trailing blanks) are nothing but normal characters.

      Their merit of course comes with embedded expressions |...{ ... }...{ ... }...|, where inside the curly brackets you have ABAP operand positions.

      Therefore writing it as

      |{ 'I have'(t01) } { two } { 'eyes'(t02) }.|
      makes it more clear.