Blame platform-overview/oc/dev-translate-setup.page

Packit 1470ea
Packit 1470ea
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="dev-translate-setup" xml:lang="oc">
Packit 1470ea
Packit 1470ea
  <info>
Packit 1470ea
    <link type="next" xref="dev-translate-build"/>
Packit 1470ea
    <revision version="0.1" date="2013-06-19" status="review"/>
Packit 1470ea
Packit 1470ea
    <credit type="author copyright">
Packit 1470ea
      <name>Michael Hill</name>
Packit 1470ea
      <email its:translate="no">mdhillca@gmail.com</email>
Packit 1470ea
      <years>2013</years>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
    <include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>
Packit 1470ea
Packit 1470ea
    <desc/>
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
  <title>Mark strings for translation</title>
Packit 1470ea
Packit 1470ea
  <links type="series" style="floatend">
Packit 1470ea
    <title>Set up translations</title>
Packit 1470ea
  </links>
Packit 1470ea
Packit 1470ea
  

Before the strings from your application can be translated, they need to

Packit 1470ea
  be extracted from the source code.

Packit 1470ea
Packit 1470ea
  

Wrap messages or string literals in your code with the

Packit 1470ea
  '_()' macro.

Packit 1470ea
Packit 1470ea
  <note>
Packit 1470ea
    

For C, this macro is defined in the <file>glib/gi18n.h</file> header

Packit 1470ea
    file, which must be included at the top of your application source.

Packit 1470ea
  </note>
Packit 1470ea
Packit 1470ea
  

Your wrapped strings should look like this:

Packit 1470ea
  _("Press a key to continue")
Packit 1470ea
Packit 1470ea
  

This marks the strings as translatable, and at runtime calls

Packit 1470ea
  <app>gettext</app> to substitute the translated strings.

Packit 1470ea
Packit 1470ea
</page>