How to Translate PHP Language File

There are variety of .PHP language files, but they have the same feature: the code and the text are separated by symbols. Therefore, we can extract the translatable text out and translate with CATs.

This short article shows how to translate the translatable text in a Joomla PHP language file.

Inside the Joomla PHP language file you will see:

DEFINE(“_NOT_AUTH”,”You are not authorised to view this resource.”);
DEFINE(“_DO_LOGIN”,”You need to login.”);
DEFINE(“_MAIN_INCLUDES_POSTMAIL”,”Thank you – you can now close this window.”);
DEFINE(“_MAIN_INCLUDES_RSS”,”Get the latest RSS feed listings”);

…and here are my steps:


  1. Select all text in your PHP file, copy & paste them into MS Excel (starting from the Column A, Row 1).
  2. Select all cells in the Column A, click the Data menu, click Text to Column, select the Delimited check box, and then click Next.
  3. In the Delimiters group box, click to clear Tab, Semicolon, Comma, and Space check boxes, select Other check box, type (“) without parentheses in the accompanying text box, and then click Finish.
  4. You should now have five columns: A, B, C, D, E. The text in the Column D is what you need to translate.
  5. Select all cells in the Column D, copy & paste into a new MS Word or Excel file for translating.


  1. Select all translated text, copy & paste into all cells in the Column D.
  2. Insert a new column between A and B, between C and D, between E and F, between G and H.
  3. Enter (“) without parentheses into all cells in four new columns B, D, F, H, which you got after insertions.
  4. Select the cell J1.
  5. For Excel 2003:
    On the Insert menu, click Function, choose Text category, double-click the CONCATENATE function.
    For Excel 2007:
    On the Formulas tab, in the Function Library group, click Text, select the CONCATENATE function.
  6. The Function Arguments dialog box appears, enter:
    A1 for Text1 box,
    B1 for Text2 box,
    C1 for Text3 box,
    D1 for Text4 box,
    E1 for Text5 box,
    F1 for Text6 box,
    G1 for Text7 box,
    H1 for Text8 box,
    I1 for Text9 box, and then click OK
  7. All PHP codes and your translation are now concatenated in the cell J1. Let’s copy the function and paste it into other cells in the Column J.
  8. Select all cells in the Column J, copy & paste over text on your PHP file. Now you got the final file for delivery.

One thought on “How to Translate PHP Language File

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s