<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Get Translation Tool]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=10685</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=10685&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Get Translation Tool.]]></description>
		<lastBuildDate>Wed, 15 Oct 2025 21:28:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Get Translation Tool]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43768#p43768</link>
			<description><![CDATA[<p>Hi I will simplify how to use the fa-pot.php file that way you can understand how it works, if something is not working go to my previous post</p><p>In this example I will be using Windows and Xampp so all the paths will follow that logic (use your paths depending on how you installed PHP)<br />Also for this particular example I will use FrontHrm module</p><p>1) Download and copy fa-pot.php into your FrontAccounting root<br />C:\xampp\htdocs\frontaccounting\fa-pot.php</p><p>2) Make sure your module has (or create) a lang folder<br />C:\xampp\htdocs\frontaccounting\modules\FrontHrm\lang</p><p>3) Run it to generate the .pot file<br />&nbsp; &nbsp; 3.1) Open Command Prompt. <br />&nbsp; &nbsp; &nbsp; &nbsp; (Win+R&nbsp; cmd)<br />&nbsp; &nbsp; 3.2) Change to your FA folder:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cd /d C:\xampp\htdocs\frontaccounting</p><p>4) Run the script with XAMPP’s PHP (C:\xampp\php\php.exe or where you have PHP installed) and point it at the module folder. <br />&nbsp; &nbsp;Redirect the output into a POT file inside the module’s lang folder: (if you want to use the same example copy and paste the following)</p><p>&quot;C:\xampp\php\php.exe&quot; fa-pot.php modules\FrontHrm &gt; modules\FrontHrm\lang\FrontHrm.pot </p><p>(Note.- In your prompt you&#039;ll see something like this:&nbsp; &nbsp; C:\xampp\htdocs\frontaccounting&gt;&quot;C:\xampp\php\php.exe&quot; fa-pot.php modules\FrontHrm &gt; modules\FrontHrm\lang\FrontHrm.pot&nbsp; &nbsp;then hit enter)</p><p>5) You should now have a file called FrontHrm.pot:</p><p>C:\xampp\htdocs\frontaccounting\modules\FrontHrm\lang\FrontHrm.pot</p><p>Once you have the file follow the next steps</p><p>6) Translate</p><p>Open FrontHrm.pot in Poedit (or your gettext tool).<br />When Poedit asks, choose the language (e.g., es_MX).<br />Save to:<br />modules\FrontHrm\lang\es_MX\LC_MESSAGES\FrontHrm.po<br />Once you translate the file compile to get the es_MX.mo file</p><p>Thats it</p>]]></description>
			<author><![CDATA[null@example.com (fburbano)]]></author>
			<pubDate>Wed, 15 Oct 2025 21:28:04 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43768#p43768</guid>
		</item>
		<item>
			<title><![CDATA[Get Translation Tool]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=43762#p43762</link>
			<description><![CDATA[<p>Hi, I don&#039;t know if this post should be placed here, but if someone find this useful (PHP PO File extractor) to build a .pot / .po for your custom FrontAccounting module.</p><p>1) Put the extractor in your FA tree fa-pot.php at the FrontAccounting root (same folder that has index.php).<br />Example path when using XAMPP: C:\xampp\htdocs\frontaccounting\fa-pot.php</p><p>2) Run it against your custom module<br />You pass the module folder as the argument and redirect output to a .pot file.</p><p>Windows (XAMPP)<br />Open CMD<br />cd C:\xampp\htdocs\frontaccounting<br />C:\xampp\php\php.exe fa-pot.php modules\YourModule &gt; modules\YourModule\lang\new_language_template\LC_MESSAGES\yourmodule.pot&nbsp; Note:This will create the clean PO file without translations</p><p>Linux / macOS<br />open console<br />cd /var/www/html/frontaccounting<br />php fa-pot.php modules/YourModule &gt; modules/YourModule/lang/new_language_template/LC_MESSAGES/yourmodule.pot&nbsp; Note:This will create the clean PO file without translations</p><p>Make sure the lang/new_language_template/LC_MESSAGES folders exists inside your module (create it if not).</p><p>3) What the script actually extracts<br />By default it scans files with extensions:<br />.php .inc .tpl .phtml .db&nbsp; and pulls strings from these gettext calls:<br />_(&quot;msg&quot;) / gettext(&quot;msg&quot;)<br />ngettext(&quot;singular&quot;,&quot;plural&quot;, $n)<br />pgettext(&quot;context&quot;,&quot;msg&quot;) / _p(&quot;context&quot;,&quot;msg&quot;)<br />Only literal strings are captured (that’s how gettext tools work).<br />If you have code like _(&quot;Hello &quot;.$name), rewrite it to:<br />sprintf(_(&quot;Hello %s&quot;), $name)<br />so the constant part is extractable.</p><p>4) Customizing (if your code uses other wrappers or file types)<br />Open fa-pot.php and edit:<br />Recognized functions (near the top, $KEYS):<br />&#039;_&#039;&nbsp; &nbsp; &nbsp; &nbsp; =&gt; [&#039;type&#039;=&gt;&#039;simple&#039;,&#039;args&#039;=&gt;[1]],<br />&#039;gettext&#039;&nbsp; =&gt; [&#039;type&#039;=&gt;&#039;simple&#039;,&#039;args&#039;=&gt;[1]],<br />&#039;ngettext&#039; =&gt; [&#039;type&#039;=&gt;&#039;plural&#039;,&#039;args&#039;=&gt;[1,2]],<br />&#039;pgettext&#039; =&gt; [&#039;type&#039;=&gt;&#039;context&#039;,&#039;args&#039;=&gt;[1,2]],<br />&#039;_p&#039;&nbsp; &nbsp; &nbsp; &nbsp;=&gt; [&#039;type&#039;=&gt;&#039;context&#039;,&#039;args&#039;=&gt;[1,2]],<br />// add your own, e.g.<br />// &#039;N_&#039; =&gt; [&#039;type&#039;=&gt;&#039;simple&#039;,&#039;args&#039;=&gt;[1]],</p><p>Scanned extensions ($EXTS):<br />$EXTS = [&#039;php&#039;,&#039;inc&#039;,&#039;tpl&#039;,&#039;phtml&#039;, &#039;db&#039;]; // add &#039;module&#039; or others if you need</p><p>5) Create a locale .po from the .pot<br />If you have GNU gettext tools, this is easiest:<br /># Example for Spanish (Spain)<br />msginit --no-translator \<br />&nbsp; --input=modules/YourModule/lang/new_language_template/LC_MESSAGES/yourmodule.pot \<br />&nbsp; --locale=es_ES.UTF-8 \<br />&nbsp; --output-file=modules/YourModule/lang/new_language_template/LC_MESSAGES/es_ES.po<br />No gettext tools? Just copy the .pot to .po and edit the header:<br /># in modules/YourModule/lang/new_language_template/LC_MESSAGES/es_ES.po<br />&quot;Language: es_ES\n&quot;<br />&quot;Content-Type: text/plain; charset=UTF-8\n&quot;<br />&quot;Plural-Forms: nplurals=2; plural=(n != 1);\n&quot;<br />Common plural forms:<br />Spanish/English: nplurals=2; plural=(n != 1);<br />French: nplurals=2; plural=(n &gt; 1);<br />Portuguese (pt_BR): nplurals=2; plural=(n &gt; 1);<br />Keep files UTF-8 (no BOM).</p><p>6) Where to keep the files in a FA module<br />A simple, module-local layout works fine:<br />modules/YourModule/<br /> lang/<br />&nbsp; &nbsp; yourmodule.pot<br />&nbsp; &nbsp; es_ES.po<br />&nbsp; &nbsp; fr_FR.po<br />FrontAccounting typically uses its own PO loader (not PHP’s gettext() extension), so you don’t need .mo unless your code explicitly uses native gettext. If you do, compile with:<br />msgfmt -o modules/YourModule/lang/es_ES.mo modules/YourModule/lang/es_ES.po</p><p>7) Quick sanity check<br />Open the generated .pot — you should see blocks like:<br />#: modules/YourModule/somefile.php:42<br />msgid &quot;Customer&quot;<br />msgstr &quot;&quot;<br />If it’s empty:<br />Your strings might be dynamic/concatenated.<br />File extensions not in $EXTS.<br />Wrapper names not listed in $KEYS.<br />Wrong path passed to the script.</p><p>8) Tiny example<br />Source:<br />echo _(&quot;Customer&quot;);<br />echo sprintf(_(&quot;Open %s invoice&quot;), $ref);<br />echo ngettext(&quot;%d item&quot;,&quot;%d items&quot;, $n);<br />echo pgettext(&quot;button&quot;,&quot;Save&quot;);<br />Extracted (snippet):<br />msgid &quot;Customer&quot;<br />msgstr &quot;&quot;<br />msgid &quot;Open %s invoice&quot;<br />msgstr &quot;&quot;<br />msgid &quot;%d item&quot;<br />msgid_plural &quot;%d items&quot;<br />msgstr[0] &quot;&quot;<br />msgstr[1] &quot;&quot;<br />msgctxt &quot;button&quot;<br />msgid &quot;Save&quot;<br />msgstr &quot;&quot;</p><p>9) Typical errors &amp; fixes<br />Path not found: modules/YourModule<br />→ Check the path you pass to the script; use quotes if there are spaces.<br />&#039;php&#039; is not recognized on Windows<br />→ Use full path to php.exe: C:\xampp\php\php.exe.<br />Empty POT or missing lines<br />→ Strings are not literal or wrappers/EXTS not configured.<br />Encoding/accents look broken<br />→ Ensure source files and PO are UTF-8 and header has charset=UTF-8.</p><p>I would love if someone do this more &quot;user friendly&quot; so an average person can translate the system and modules to any language</p>]]></description>
			<author><![CDATA[null@example.com (fburbano)]]></author>
			<pubDate>Thu, 02 Oct 2025 18:36:31 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=43762#p43762</guid>
		</item>
	</channel>
</rss>
