Subrata
Subrata

Reputation: 2284

Translation in Magento from a single file

Is it possible to have a single CSV file to make all the translation ? Similar to as we can do all xml changes from a single file local.xml

I downloaded a Swedish translation package and tried to translate some words which are not yet been translated. I saw the csv files are named similar to the xml layout files. So was curious to know if there is any possibility to have similar functionality with translation ?

I appreciate your help.

Upvotes: 1

Views: 2678

Answers (3)

sanji
sanji

Reputation: 1310

You can use any of Magento core helpers. I use sales helper in my admin custom module, it works for me now. Important thing is we want to set locale in our custom module as well.

if ($order->getStoreId()) {
                Mage::app()->getLocale()->emulate($order->getStoreId());
                Mage::app()->setCurrentStore($order->getStoreId());
            }

$page->drawText(Mage::helper('sales')->__('Packing Note'), 30, $this->y, 'UTF-8');

I added translation file to default translation files(Mage_sales.csv) for all locale. It's working for me.

Upvotes: 1

Rohit S
Rohit S

Reputation: 1040

You need to create a file translate.csv inside the folder app/design/your_theme/locale/_localecode_/ and you can enter the translation text there. Check out this link for more details

Upvotes: 1

Vishnu R
Vishnu R

Reputation: 1879

CSV files are organised as modules in magento locale. But you can place the text you need to translate in any CSV file as you wish. It will work. But note that, it should be under that particular language's folder, to which you need to translate.

For an example assume you have a module first_module.csv. You can place any text you need to translate in this file. No matter even the text is from any other modules. The translation will work if this module is enabled.

As far as I know, By organizing CSVs by modules, you can control the translation of text, according to various modules. But if not, you wont have any such module vise control over translation.

Upvotes: 0

Related Questions