Sign in Join
Wiki copytemporary

Getting translation strings right/es: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-Esta página contiene algunas notas básicas acerca de como traducir cadenas de forma correcta desde el principio, desde el punto de vista de los escritores originales (e.g. muy a menudo programadores).
2-
3-"Para hacer lo correcto" en este contexto, significa que las cadenas de traducción se han preparado apropiadamente para una traducción lo más aproximada posible, y que la versión original se ha adaptado a los requerimientos básicos para su uso.
1+Esta página contiene algunas notas básicas acerca de como traducir cadenas de forma correcta desde el principio, desde el punto de vista de los escritores originales (e.g. muy a menudo programadores).
42
5-Aunque se trata de que sea lo más neutral posible al lenguaje, hay de hecho una ligera tendencia al inglés en particular. Sentiros libres para extender o descartalas a lo que no sea aplicable a vuestra situación (¿y puede que también las añadais a esta página?).
3+"Para hacer lo correcto" en este contexto, significa que las cadenas de traducción se han preparado apropiadamente para una traducción lo más aproximada posible, y que la versión original se ha adaptado a los requerimientos básicos para su uso.
64
7-
5+Aunque se trata de que sea lo más neutral posible al lenguaje, hay de hecho una ligera tendencia al inglés en particular. Sentiros libres para extender o descartalas a lo que no sea aplicable a vuestra situación (¿y puede que también las añadais a esta página?).
86
9-## Contents
7+### General
108
11- * 1 General
12- * 1.1 Asegúrate de que las cadenas en tu lenguaje original están impecables, claras y consistentes
13- * 2 Technical issues
14- * 2.1 Resourcestrings, and GNU gettext
15- * 2.2 ResourceStrings in the IDE
16- * 2.3 ResourceStrings in your Application
17- * 2.4 The format() function
18- * 2.5 Convirtiendo la traducción al código de caracteres correcto
19- * 3 English related
20- * 4 See also
9+Para evitar problemas, simplemente asegúrate de que **las cadenas originales están correctas** en primer lugar - hay algunas razones para hacer esto:
2110
22-### General
11+- Las cadenas originalmente se utilizan habitualmente como traducciones por defecto, creando una mala impresión al usuario final que suele utilizar las cadenas por defecto.
2312
24-Para evitar problemas, simplemente asegúrate de que **las cadenas originales están correctas** en primer lugar - hay algunas razones para hacer esto:
13+- Incluso peor, esto hace el trabajo del traductor innecesariamente duro: tendrá más problemas al trasladar la información original a otro lenguaje.Simplemente recuerda el principio "Basura de entrada, Basura de salida" que se aplica aquí perfectamente.
2514
26- * Las cadenas originalmente se utilizan habitualmente como traducciones por defecto, creando una mala impresión al usuario final que suele utilizar las cadenas por defecto.
15+#### Asegúrate de que las cadenas en tu lenguaje original están impecables, claras y consistentes
2716
28- * Incluso peor, esto hace el trabajo del traductor innecesariamente duro: tendrá más problemas al trasladar la información original a otro lenguaje.Simplemente recuerda el principio "Basura de entrada, Basura de salida" que se aplica aquí perfectamente.
17+Given the above, please find some tips when writing messages/strings for user consumption.
2918
30-
19+Trata de asegurarte de que tu **ortografía sea correcta** - utiliza un diccionario si no estás seguro.
3120
32-#### Asegúrate de que las cadenas en tu lenguaje original están impecables, claras y consistentes
21+Utiliza frases comprensibles y bien conocidas para la situación que se quiere describir, de una manera **consistente**. Si no tienes la seguridad de que sea la interpretación correcta , prueba a poner otros programas en la misma situación y examina sus respuestas. La literatura y ficheros de ayuda son además frecuentemente un buen recurso para acertar con frases o términos especiales, o incidencias de estilo.
3322
34-Given the above, please find some tips when writing messages/strings for user consumption.
23+Prueba a ser consistente también a la hora de escoger las frases. Por ejemplo las preguntas:
3524
36-Trata de asegurarte de que tu **ortografía sea correcta** \- utiliza un diccionario si no estás seguro.
25+`Delete the file?`\
26+`Erase the file?`\
27+`Remove the file?`\
28+`Wipe the file?`\
29+`Zap the file?`
3730
38-Utiliza frases comprensibles y bien conocidas para la situación que se quiere describir, de una manera **consistente**. Si no tienes la seguridad de que sea la interpretación correcta , prueba a poner otros programas en la misma situación y examina sus respuestas. La literatura y ficheros de ayuda son además frecuentemente un buen recurso para acertar con frases o términos especiales, o incidencias de estilo.
31+tienen todas un significado similar, pero cuando se utilizan de manera intercambiable, los lectores pueden empezar a probar e inventar un (no existente) significado cada distinta terminología.
3932
40-Prueba a ser consistente también a la hora de escoger las frases. Por ejemplo las preguntas:
41-```
42-Delete the file?
43- Erase the file?
44- Remove the file?
45- Wipe the file?
46- Zap the file?
47-```
33+Los traductores son especiamente muy propensos a cometer este error, dado que a menudo desconocen el contexto exacto de un mensaje en particular (e.g. información sobre el mensaje original) y pueden interpretar variaciones de palabras como indicación de diferencias importantes y estará tentado de utilizar traducciones poco comunes y por tanto malas traducciones.
4834
49-tienen todas un significado similar, pero cuando se utilizan de manera intercambiable, los lectores pueden empezar a probar e inventar un (no existente) significado cada distinta terminología.
35+Un montón de software de traducción (e.g Virtaal) te puede ayudar de dos maneras:
5036
51-Los traductores son especiamente muy propensos a cometer este error, dado que a menudo desconocen el contexto exacto de un mensaje en particular (e.g. información sobre el mensaje original) y pueden interpretar variaciones de palabras como indicación de diferencias importantes y estará tentado de utilizar traducciones poco comunes y por tanto malas traducciones.
37+- Tiene una memoria de traducción que te permite recordar todas las cadenas (strings) ya traducidas y ayudarte a traducir términos consistentemente.
5238
53-Un montón de software de traducción (e.g Virtaal) te puede ayudar de dos maneras:
39+- Te muestra como se encuentran traducidas las cadenas en otros softwares de código abierto, ofreciéndote las formas más frecuentemente utilizadas.
5440
55- * Tiene una memoria de traducción que te permite recordar todas las cadenas (strings) ya traducidas y ayudarte a traducir términos consistentemente.
41+Especially for error messages to the user: try to **describe the problem** itself in appropriate words. This is never the state of the program which led to the error message. This is only useful for the person debugging the program, but not for the user. Users will either simply shrug their shoulders and ignore it in the best case, or choose another program in the worst case because without a proper problem description the user will not be able to fix the problem and continue his work - all that only because the program was not able to give a proper problem description.
5642
57- * Te muestra como se encuentran traducidas las cadenas en otros softwares de código abierto, ofreciéndote las formas más frecuentemente utilizadas.
43+Give (easily) **understandable descriptions**. Do not try to impress your audience with foreign or very technical words only for telling that the current work has not yet been saved if not really necessary.
5844
59-
60-Especially for error messages to the user: try to **describe the problem** itself in appropriate words. This is never the state of the program which led to the error message. This is only useful for the person debugging the program, but not for the user. Users will either simply shrug their shoulders and ignore it in the best case, or choose another program in the worst case because without a proper problem description the user will not be able to fix the problem and continue his work - all that only because the program was not able to give a proper problem description.
45+Especially try to avoid multiple negations within a single sentence in your wordings, they are nearly always harder to read than their non-negated counterparts. An example could be
6146
62-Give (easily) **understandable descriptions**. Do not try to impress your audience with foreign or very technical words only for telling that the current work has not yet been saved if not really necessary.
47+`This component can not be dropped on non-TControls.`
6348
64-Especially try to avoid multiple negations within a single sentence in your wordings, they are nearly always harder to read than their non-negated counterparts. An example could be
65-```
66-This component can not be dropped on non-TControls.
67-```
49+which, in its non-negated form
6850
69-which, in its non-negated form
70-```
71-This component can only be dropped on TControls.
72-```
51+`This component can only be dropped on TControls.`
7352
74-is certainly easier to read and understand.
53+is certainly easier to read and understand.
7554
7655### Technical issues
7756
78-In this section a short overview of technical issues, basically an overview of existing possibilites are given. These include the resourcestring construct, GNU gettext() and the format() function.
57+In this section a short overview of technical issues, basically an overview of existing possibilites are given. These include the resourcestring construct, GNU gettext() and the format() function.
7958
8059#### Resourcestrings, and GNU gettext
8160
82-Free Pascal has some built-in language constructs for providing a way of handling constant strings. There is a special section of a unit called "resourcestring" which was specifically introduced for this reason. See the appropriate section of the FPC manual (prog.pdf, pg. 89ff or [here](<http://www.freepascal.org/docs-html/prog/progch9.html#x184-1870009>)) for the details.
61+Free Pascal has some built-in language constructs for providing a way of handling constant strings. There is a special section of a unit called "resourcestring" which was specifically introduced for this reason. See the appropriate section of the FPC manual (prog.pdf, pg. 89ff or [here](http://www.freepascal.org/docs-html/prog/progch9.html#x184-1870009)) for the details.
8362
84-GNU gettext is a special set of utilities to provide translations for your programs, see the FPC manual once more (prog.pdf, pg. 91ff or [here](<http://www.freepascal.org/docs-html/prog/progse41.html#x210-2130009.4>)).
63+GNU gettext is a special set of utilities to provide translations for your programs, see the FPC manual once more (prog.pdf, pg. 91ff or [here](http://www.freepascal.org/docs-html/prog/progse41.html#x210-2130009.4)).
8564
86-![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Nota:** GNU gettext has a conceptual flaw which does not allow mapping of a single original string to multiple translated strings, be aware of that.
65+> **Note:** GNU gettext has a conceptual flaw which does not allow mapping of a single original string to multiple translated strings, be aware of that.
8766
8867#### ResourceStrings in the IDE
8968
90- * Lazarus has a tool to easily create resourcestrings from string constants. See [[IDE Window: Make ResourceString|Make ResourceString]]
69+- Lazarus has a tool to easily create resourcestrings from string constants. See [[IDE Window: Make ResourceString|Make ResourceString]]
9170
92- * For each resourcestring section FPC creates a .rst file, but there are no editor for these files. Lazarus can automatically create .po files of the .rst files. There are a lot of tools to edit .po files (e.g. kbabel).
71+- For each resourcestring section FPC creates a .rst file, but there are no editor for these files. Lazarus can automatically create .po files of the .rst files. There are a lot of tools to edit .po files (e.g. kbabel).
9372
94-To enable creating the .po files for a package do the following:
95-```
96-* Create a sub directory 'languages' (or 'locale', or whatever)
97- * Open the package. Then Options -> IDE Integration -> Directory of .po files set to _languages_
98-```
73+To enable creating the .po files for a package do the following:
9974
100-The next time you compile the package, the IDE will create the .po files.
75+` * Create a sub directory 'languages' (or 'locale', or whatever)`\
76+` * Open the package. Then Options -> IDE Integration -> Directory of .po files set to `*`languages`*
10177
102-![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Nota:** The .rst files must belong to package units. Otherwise the IDE ignores foreign .rst files.
78+The next time you compile the package, the IDE will create the .po files.
10379
104-The same works for projects. The directory is set in Project -> Project Options -> IDE Integration -> Directory of .po files.
80+> **Note:** The .rst files must belong to package units. Otherwise the IDE ignores foreign .rst files.
10581
106- * To create a German translation: copy the unit1.po file to unit1.de.po. Then use a text editor or a .po Editor to translate all strings.
82+The same works for projects. The directory is set in Project -\> Project Options -\> IDE Integration -\> Directory of .po files.
10783
108- * The IDE will automatically load .po files for installed packages, if they exists. For example see lazarus/components/projecttemplates/languages/.
84+- To create a German translation: copy the unit1.po file to unit1.de.po. Then use a text editor or a .po Editor to translate all strings.
10985
110- * ToDo: Implement and document updating the translated .po files when new resourcestrings are added.
86+- The IDE will automatically load .po files for installed packages, if they exists. For example see lazarus/components/projecttemplates/languages/.
11187
112- * ToDo: Implement and document collecting all .po files of statically linked packages.
88+- ToDo: Implement and document updating the translated .po files when new resourcestrings are added.
11389
90+- ToDo: Implement and document collecting all .po files of statically linked packages.
91+
11492#### ResourceStrings in your Application
11593
116-You can load the .po files at initialization to translate the resourcestrings. Add this to your .lpr file:
117-```
94+You can load the .po files at initialization to translate the resourcestrings. Add this to your .lpr file:
95+
96+``` pascal
11897...
119- uses
120- ...
121- Translations, LazUTF8;
122-
123- procedure TranslateLCL;
124- var
125- PODirectory, Lang, FallbackLang: String;
126- begin
127- PODirectory:='/path/to/lazarus/lcl/languages/';
128- Lang:='';
129- FallbackLang:='';
130- LazGetLanguageIDs(Lang,FallbackLang); // in unit LazUTF8
131- Translations.TranslateUnitResourceStrings('LCLStrConsts',
132- PODirectory+'lclstrconsts.%s.po',Lang,FallbackLang);
133- // ... add here a TranslateUnitResourceStrings call for every po file ...
134- end;
135-
136- begin
137- TranslateLCL;
138- Application.Initialize;
139- Application.CreateForm(TForm1, Form1);
140- Application.Run;
141- end.
98+uses
99+ ...
100+ Translations, LazUTF8;
101+
102+procedure TranslateLCL;
103+var
104+ PODirectory, Lang, FallbackLang: String;
105+begin
106+ PODirectory:='/path/to/lazarus/lcl/languages/';
107+ Lang:='';
108+ FallbackLang:='';
109+ LazGetLanguageIDs(Lang,FallbackLang); // in unit LazUTF8
110+ Translations.TranslateUnitResourceStrings('LCLStrConsts',
111+ PODirectory+'lclstrconsts.%s.po',Lang,FallbackLang);
112+ // ... add here a TranslateUnitResourceStrings call for every po file ...
113+end;
114+
115+begin
116+ TranslateLCL;
117+ Application.Initialize;
118+ Application.CreateForm(TForm1, Form1);
119+ Application.Run;
120+end.
142121```
143122
144-![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Nota:** for Mac OS X: The supported language IDs should be added into the application bundle property list to CFBundleLocalizations key, see lazarus.app/Contents/Info.plist for example.
123+> **Note:** for Mac OS X: The supported language IDs should be added into the application bundle property list to CFBundleLocalizations key, see lazarus.app/Contents/Info.plist for example.
145124
146125#### The format() function
147126
148-To not only allow completely static strings in translations, you can use the [format()](<http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/format.html> "doc:rtl/sysutils/format.html") method of the sysutils unit. It is able to replace placeholders within a given text by their actual value given as secondary parameter in a set.
127+To not only allow completely static strings in translations, you can use the [[doc:rtl/sysutils/format.html|format()]] method of the sysutils unit. It is able to replace placeholders within a given text by their actual value given as secondary parameter in a set.
149128
150-Por ejemplo:
151-```
152-format('Mañana **%0:s** **%1:s** el sol. ', ['**Domingo'** , '**brillará'**]);
153-```
129+Por ejemplo:
154130
155-retornara
156-```
157-Mañana **Domingo** **brillará** el sol
158-```
131+`format('Mañana `**`%0:s`**`  `**`%1:s`**` el sol. ', [`**`'Domingo`**`', `**`'brillará`**`']);`
159132
160-In this case the %0:s is a placeholder para el primer argumento (index 0) in the set of actual values (Sunshine), and likewise %1:s. For an exact definition of the allowed placeholders and their syntax see the FPC reference manual.
133+retornara
161134
162-Some guidelines for the usage of the format() function
135+`Mañana `**`Domingo`**` `**`brillará`**` el sol`
163136
164- * Try to use indexed placeholders in the original strings, even if they are optional. When used, they allow the translator to move the arguments easily within the sentence allowing him more natural expressions (and actually sometimes moving sentence parts is required to create proper sentences in that language).
137+In this case the %0:s is a placeholder para el primer argumento (index 0) in the set of actual values (Sunshine), and likewise %1:s. For an exact definition of the allowed placeholders and their syntax see the FPC reference manual.
165138
166- * Never compose a sentence out of more than one string. Always use the format() method from the sysutils unit to construct the correct string using placeholders during runtime. Translators will usually not be able to reconstruct the whole sentence, therefore not able to give a good translation; only consider that there are often hundreds of such strings within a single translation database...
139+Some guidelines for the usage of the format() function
167140
168- * Do not format using whitespaces. Simply move your label to the appropriate position in the first place. There may be problems with font changes, and seemingly superfluous spaces will be in danger of being trimmed by the translator.
141+- Try to use indexed placeholders in the original strings, even if they are optional. When used, they allow the translator to move the arguments easily within the sentence allowing him more natural expressions (and actually sometimes moving sentence parts is required to create proper sentences in that language).
169142
170-![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Nota:** ~~Since format() does not interpret escaped control characters (e.g. like C's "\n", "\t", etc) and GNU gettext for any reason being the translation system of choice (and the tools based on it not being able to interpret non-escaped control characters), it is required to programmatically insert linebreaks.~~ In the current lazarus version, "\n" and "\t" in translated strings are replaced by newline and tab.
143+- Never compose a sentence out of more than one string. Always use the format() method from the sysutils unit to construct the correct string using placeholders during runtime. Translators will usually not be able to reconstruct the whole sentence, therefore not able to give a good translation; only consider that there are often hundreds of such strings within a single translation database...
171144
145+- Do not format using whitespaces. Simply move your label to the appropriate position in the first place. There may be problems with font changes, and seemingly superfluous spaces will be in danger of being trimmed by the translator.
146+
147+> **Note:** ~~Since format() does not interpret escaped control characters (e.g. like C's "\n", "\t", etc) and GNU gettext for any reason being the translation system of choice (and the tools based on it not being able to interpret non-escaped control characters), it is required to programmatically insert linebreaks.~~In the current lazarus version, "\n" and "\t" in translated strings are replaced by newline and tab.
148+
172149#### Convirtiendo la traducción al código de caracteres correcto
173150
174-Por ejemplo: convirtiendo un fichero de ISO-8859-1 a UTF-8:
175-```
176-iconv --from-code=ISO-8859-1 --to-code=UTF-8 oldfile.po > nuevofichero.po
177-```
151+Por ejemplo: convirtiendo un fichero de ISO-8859-1 a UTF-8:
178152
179-No olvidarse de cambiar la línea:
180-```
181-"Content-Type: text/plain; charset=ISO-8859-1\n"
182-```
153+` iconv --from-code=ISO-8859-1 --to-code=UTF-8 oldfile.po > nuevofichero.po`
183154
184-por
185-```
186-"Content-Type: text/plain; charset=UTF8\n"
187-```
155+No olvidarse de cambiar la línea:
188156
157+` "Content-Type: text/plain; charset=ISO-8859-1\n"`
158+
159+por
160+
161+` "Content-Type: text/plain; charset=UTF8\n"`
162+
189163### English related
190164
191-This section contains notes which particularly apply when using English as the base language for translations.
165+This section contains notes which particularly apply when using English as the base language for translations.
192166
193- * Make sure to reserve enough space where the text is output: English is a language in which texts are almost always shorter (in characters) than their respective translations, so plan ahead by reserving enough space. Experience shows that very short strings of a few characters length often almost double in size; this difference decreases as the strings get longer.
167+- Make sure to reserve enough space where the text is output: English is a language in which texts are almost always shorter (in characters) than their respective translations, so plan ahead by reserving enough space. Experience shows that very short strings of a few characters length often almost double in size; this difference decreases as the strings get longer.
194168
195- * Avoid abbreviations in English; in addition to the fact that this shortens the already short strings even more, there are severe problems with e.g. languages that use ideographic characters where these abbreviations simply do not exist at all.
169+- Avoid abbreviations in English; in addition to the fact that this shortens the already short strings even more, there are severe problems with e.g. languages that use ideographic characters where these abbreviations simply do not exist at all.
196170
197- * Since this is often an issue: In English punctuation marks (full stop, comma, ...) are part of the previous words, or form some sort of words themselves if there is no previous word (in case of an enumeration). Especially after a semicolon there should always be a trailing space.
171+- Since this is often an issue: In English punctuation marks (full stop, comma, ...) are part of the previous words, or form some sort of words themselves if there is no previous word (in case of an enumeration). Especially after a semicolon there should always be a trailing space.
198172
199-```
200-There was an error ! Please check file settings , compiler settings,... to fix this issue.
201-```
173+`There was an error ! Please check file settings , compiler settings,... to fix this issue.`
202174
203-has horrible punctuation and therefore simply looks bad and is harder to read than usual. Consider that common line break algorithms break the line on whitespaces, possibly resulting in a single stop at the beginning of a line...
204-```
205-There was an error! Please check file settings, compiler settings, ... to fix this issue.
206-```
175+has horrible punctuation and therefore simply looks bad and is harder to read than usual. Consider that common line break algorithms break the line on whitespaces, possibly resulting in a single stop at the beginning of a line...
207176
208-would probably be okay only considering punctuation.
177+`There was an error! Please check file settings, compiler settings, ... to fix this issue.`
209178
179+would probably be okay only considering punctuation.
180+
210181### See also
211182
212- * [[Translations / i18n / localizations for programs]]
213- * [[Lazarus Documentation|Translating/Internationalization/Localization]]
214- * [[Step-by-step instructions for creating multi-language applications]]
183+- [[Translations / i18n / localizations for programs]]
184+- [[Lazarus Documentation|Translating/Internationalization/Localization]]
185+- [[Step-by-step instructions for creating multi-language applications]]
215186
216187---
217-*From the Free Pascal wiki, page "Getting translation strings right/es", as the Internet Archive kept it on 2025-03-22. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
188+*From the Free Pascal wiki, page "Getting translation strings right/es", as it stood on 2020-02-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history