IDE Window: Make ResourceString/fr

This is an old revision of IDE Window: Make ResourceString/fr, edited by Wile64 at . The current revision is 41351.

/* Où mettre la nouvelle marque dans la section resourcestring */

This wizard helps to convert a string constant into a resourcestring.

Place the cursor on a string constant or select the part of the constant that should be converted. Then invoke Tools -> Make Resource String.

A string constant is for example 'Some text'.

Options de conversion

Préfixe de marque

Vous pouvez créer automatiquement une nouvelle marque. La nouvelle marque commencera par le préfixe, suivi des mots de la constante chaine. S'il y a déjà une resourcestring avec cette valeur, l'ancienne marque sera suggérée. The IDE remembers the prefixes for each unit, so the last used prefix for the current unit is preselected first.

Longueur de marque

C'est la longueur maximum de la marque automatiquement créée.

Marque personnel

Au lieu d'employer une marque automatiquement créée, vous pouvez indiquer la marque tout seul ici.

Section Resourcestring

Ce combobox contient toutes les sections resourcestring disponibles de toutes les unités dans la portée. Cela signifie toutes les sections de l'unité courante plus toutes les sections interface de toutes les unités utilisées.

Chaine avec la même valeur

Ce combobox contient toutes les marques resourcestring avec la même valeur que le nouveau resourcestring. Vous pouvez choisir ici, si vous voulez prendre l'un d'entre eux.

Où mettre la nouvelle marque dans la section resourcestring

Si une nouvelle marque est créée, ceci définit où on l'ajoutera dans la section resourcestring.

String constant in source

This shows the old or current source code.

Source preview

This is a preview, how the string constant is replaced, followed by a line of dashes and then a preview of how the resourcestring will look like.

Examples

Example 1: Setting the caption of a form

If you do not have already a resource strin section, start one in the interface part of the unit. For example right above the 'implementation' keyword:

 resourcestring
   rsSomeText = 'Some text';

Add in the FormCreate event the following line:

 Caption:='An example caption';

Place the cursor on the string constant, i.e. somewhere between the two '. Then do Tools -> Make Resource String

Set in the identifier prefix 'rs' without the '. The new automatically suggested identifier will be 'rsAnExampleCaption'. The preview shows

   Caption:=rsAnExampleCaption;
 --------------------------------------------------------------------------------
 rsAnExampleCaption = 'An example caption'   

Click ok.

Example 2 : Complex string constants

When converting a complex string expression with variables and functions, the tool will use the Format function. For instance the statement:

 Caption:='Left='+IntToStr(Left)+' Top='+IntToStr(Top);

will be replaced with

 Caption:=Format(rsLeftTop, [IntToStr(Left), IntToStr(Top)]);

and the new resourcestring will be

 rsLeftTop = 'Left=%s Top=%s'      

The Format function is defined in the SysUtils unit. If your unit uses section does not already contain it, you must add it yourself.