Due to essential maintenance, access to Trados cloud will be unavailable on Saturday 30 August from 00:00 to 12:00 UTC.

How to handle php files ?

Hi Team,

I was looking on this forum how to handle php files, i went through a video from Paul Filkin, well explained actually.

Nevertheless, i am struggling in defining the rules for my type of file (indeed, the file structure is different compared with the example he took).

Could you please advise what regular expression should I configure ? I am at ease with that.

Thank you in advance for your help,

Best regards,

Parents
  • Here is an example of the file to translate in Trados Studio 2017 :

     

    // Définition des messages de la section 1
    define(S1_TITRE,"Adhésifs");
    define(S1_TEXTE,"<p>En standard, nous vous proposons deux types de film adhésif</p>");

    define(S1P1_TEXTE,"
    <h3>KITAPON</h3>
    <p>Nouvelle génération d'adhésif sec.
    Collez, décollez à 100%.<br>
    Se colle uniquement avec de l'EAU, pas de colle, ni d'adhésif chimique ni solvant.<br>
    Peut-être collé, décollé, recollé, encore et encore...<br>
    Peut également rester collé pour des années.<br>
    KITAPON peut être décollé en quelques secondes et utilisé ailleurs, il n'est jamais perdu.<br>
    Excellent rapport qualité/prix.<br>
    Élimine les risques rencontrés avec les films adhésifs classiques (bulles, mauvaise position...).<br>
    Besoin de le changer de place, de l'enlever car la surface de collage n'était pas parfaitement propre et qu'il reste des imperfections ? Décollez-le simplement et recollez-le facilement.<br>
    <ul>
    <li>Épaisseur : 300 microns</li><br>
    <li>KITAPON est très résistant</li><br>
    <li>Il peut être roulé, stocké, et coupé sur mesure</li><br>
    <li>Disponible à l'unité et en rouleaux de 5 à 25m (120 ou 140cm de large)</li>
    </ul>
    </p>
    ");

  • Hi  

    Try using the default document structure, and then add these rules for inline tags:

    define\(.+?"
    //.+
    "\);
    <[^>]+>

    Best to work in TagID mode as well so you make sure you use the right tags in the right place.  I also put a copy of my settings file handling your example here:

    guillaume_php.zip

    Regards

    Paul

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Thank you so much Paul for your answer!

    It works quite well now.

    However, I still have the following issues:

    1. the "<?php" delimiter in the beginning of the file and its counterpart "?>" at the end remain visible;
    2. the French accented letters are not managed (I get "Réalisez" instead of "Réalisez";
    3. The HTML incorporated tags remain visible (like "<p>" or "<ol>/</ol>" and so on;
    4. I also get some PHP code which remains visible (like "if (LANG=="EN") {...}")

    I realize that my questions may seem straightforward and I apologize for that.

    Thanks anyway in advance for any information you can give me to help.

    Kind regards,
    Guillaume
Reply
  • Thank you so much Paul for your answer!

    It works quite well now.

    However, I still have the following issues:

    1. the "<?php" delimiter in the beginning of the file and its counterpart "?>" at the end remain visible;
    2. the French accented letters are not managed (I get "Réalisez" instead of "Réalisez";
    3. The HTML incorporated tags remain visible (like "<p>" or "<ol>/</ol>" and so on;
    4. I also get some PHP code which remains visible (like "if (LANG=="EN") {...}")

    I realize that my questions may seem straightforward and I apologize for that.

    Thanks anyway in advance for any information you can give me to help.

    Kind regards,
    Guillaume
Children