Git Product home page Git Product logo

Comments (7)

ConjuringCoffee avatar ConjuringCoffee commented on July 17, 2024 3

Maybe I'm missing something, but does this not work...?

DATA(lv_test) = |{ 'Some text'(001) } more text|.

from styleguides.

bjoern-jueliger-sap avatar bjoern-jueliger-sap commented on July 17, 2024 3

Translatable text often is a bit different, I'd argue, in that you probably shouldn't assemble it with either of those methods in the first place, but use message texts with placeholders instead, because in other languages the order of the text fragments might be different or certain grammatical constructions work differently.

For instance, non-translatably I might construct a text like

  data(str) = |Customer { customer }'s total amount owed is { amount }.|.

but if you want to make this translatable, the correct way isn't to make translatable texts of the fragments

  " Don't do this
  data(str) = |{ 'Customer'(001) } { customer }{ '''s total amount owed is'(002) } { amount }.|.

but instead to create a message text Customer &1's total amount owed is &2. and then use that with

  message ... with customer amount into data(str).

This isn't really about readability of the code but primarily about getting good translations: While in English the possessive marker 's appears only in text-002, and text-001 bears no case marker, in many languages the "Customer" in text-001 would need to be declined in agreement with the possessive case of the customer's name - but someone just translating text-001 can't know that (and you might even be tempted to reuse text-001 in other contexts where "Customer" appears in English but is not related to a possessive at all).

from styleguides.

BaerbelW avatar BaerbelW commented on July 17, 2024

Thanks for the quick reply! That might have been a combination I hadn't tried but did now and it seems to work in our NW 7.50 system. Just not really sure, what the advantage over concatenation with "&&" is which is - to me - much faster to type and interpret than the version with "|" and "{ }".

How about expanding the code example with the version for translatable text?

from styleguides.

BaerbelW avatar BaerbelW commented on July 17, 2024

Hi Björn,
thanks for the detailed feedback! Yes, translatable texts and whether or not a simple concatenation will do or a proper message is better will depend a lot on context. I often use the concatenation for things like header information in ALV-output and there a messages would be a bit of an "overkill" as grammer or sentence structure doesn't play a role in something like this:

CONCATENATE '# of sales-orgs:'(c01) lv_cnt_txt INTO lv_text.

For other kind of text, I am usually working with messages where that makes sense.

from styleguides.

bjoern-jueliger-sap avatar bjoern-jueliger-sap commented on July 17, 2024

Yeah, I think in such a simple case there isn't a lot of reasons to strictly follow the rule about using |. Still, I personally would do it because it's good to get into the habit of using it, anyway.

from styleguides.

pokrakam avatar pokrakam commented on July 17, 2024

Just a thought: You can try to find a suitable DDIC domain for ALV headers and the likes, or there's no harm in creating one. It's possibly more efficient and definitely more reusable than a translatable text element.

from styleguides.

bjoern-jueliger-sap avatar bjoern-jueliger-sap commented on July 17, 2024

Since there haven't been any other arguments for a while, people seem to be generally fine with the rule in the guide staying as it is - feel free to reopen the discussion if there aren't any other edge cases to consider

from styleguides.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.