do not click

Meeting C++ 2024   |  Online   |  Training   |  Books   |  Survey   |  Job fair   |  Advertising   |  Jobposting   |  Login

Meeting C++ 2024 - Not getting lost in translations

Conference | Live Schedule | Talks | Get your ticket | Slides | Set your timezone

Not getting lost in translations

Join session

Watch the interview

Daniela Engert

On Day 3 at 11:40 (CET/Berlin) in Track C [Jade Room and online]

Languages are difficult. Foreign languages even more so. This applies not only to people, but also to computers. Nevertheless, we must always try to find the most appropriate formulations that convey our intentions as clearly and comprehensibly as possible, regardless of the language in which we express ourselves.

As software developers, one of our tasks is to ensure intuitive operation - regardless of the language the user (or compiler!) understands best. Otherwise, the risk of errors increases and operational safety may no longer be guaranteed.

National language adaptations - possibly dynamically at runtime - appear to be a solved problem area. There are libraries for this. However, if you want to use them together with std::format or std::print, you will realise that none of them allow translation at runtime, because the format strings must be C++ literals! The compiler analyses these during program translation in order to detect errors in the use of formatting instructions and argument types. This is one of the main advantages of std/fmt formatting over the other options, which only detect errors during runtime!

I am currently developing a library for our company's machines that allows error detection at translation time, but still allows dynamic translation into the user's preferred language.

Human languages do not always follow immediately recognisable rules, e.g. when it comes to the correct choice of a linguistic form in connection with statements about several things. The Unicode Standard describes such rules in machine-readable form, which the library uses to provide the correct translation.

For the implementation of the library, it is crucial to convert known idioms from the programming of runtime code into semantically correct equivalent code for execution at translation time. Despite 'constexpr', some code looks unfamiliar at first when it is translated into the language of execution at compile time.

In the course of the presentation we will therefore talk about

  • a widely used system for language translation
  • existing libraries for this, and their APIs or embedding in the build process
  • plural rules and their processing
  • differences and similarities of code execution at runtime and translation time
  • the 'language rules' for translation between the two

Code excerpts from my library serve to illustrate the points mentioned.

Please login to comment

Copyright Meetingcpp GmbH Imprint Privacy Policy