help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with emacs scripting


From: Andreas Röhler
Subject: Re: Help with emacs scripting
Date: Thu, 12 Apr 2012 18:36:03 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.28) Gecko/20120306 SUSE/3.1.20 Thunderbird/3.1.20

Am 12.04.2012 18:10, schrieb Daniel Sousa:
I'm majoring in applied math and computation, I know pretty well that
computers are dumb xD

I think neither of you have understood what I wanted, so I'll give you an
example.
I have a lot of .xsl that generate pages and I want to make those pages
translatable. I migth have the file, for exemple, welcome.xsl:
  <?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="html" indent="yes" encoding="iso-8859-1" />
  <xsl:template match="/">
<xsl:if test="welcome">
  <p>Bem-vindo</p>
</xsl:if>
  <ul>
<xsl:for-each select="elements">
<li>Coisa<xsl:value-of select="name" /></li>
  </xsl:for-each>
</ul>
</xsl:template>
  </xsl:stylesheet>
And I wanted to make this translatable, so I change this to
  <?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="html" indent="yes" encoding="iso-8859-1" />
  <xsl:template match="/xml">
<xsl:if test="welcome">
  <p><xsl:value-of select="/xml/lang/_WELCOME" /></p>
</xsl:if>
  <ul>
<xsl:for-each select="elements">
  <li>  <xsl:value-of select="/xml/lang/_STUFF" />   <xsl:value-of
select="name" /></li>
</xsl:for-each>
  </ul>
</xsl:template>
  </xsl:stylesheet>
And I create a languages/pt.php with:
  define('_LANG_WELCOME','Bem-vindo');
  define('_LANG_STUFF','Coisa');

I have a piece of php code that puts in the xml all the constants that
begin with "_LANG".

I have a lot of these .xsl and I need to go manually through them all to
find the strings that I want to make translatable. What I want this script
to do is, on my input put that<xsl:value-of select="/xml/lang/_STUFF"
/>  thing on the place I select and append to the language file the
repective define();.


looks like a task for that:

from a dired-buffer

M-x dired-mark-files-regexp RET ...

with marked files than

M-x dired-do-query-replace-regexp RET ...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]