Difference between revisions of "Change Language Files"

From Phoenix Cart User Guide
 
(96 intermediate revisions by the same user not shown)
Line 1: Line 1:
<span class="btn-grey"><historylink type="back">&#129032; Back</historylink></span>
+
<div class="btn btn-grey btn-back">{{#fas:arrow-left}} Back</div> <div class="btn btn-grey btn-setup-shop">{{#fas:play-square}} [[Set_Up_Store|Set Up Store]]</div>
<span class="btn-grey" style="color:#0088dd;">'''[[SET UP SHOP|&#x1F809; SET UP SHOP]]'''</span>
 
 
<hr>
 
<hr>
<big>'''ABOUT LANGUAGE FILES'''</big>
+
__TOC__
 +
__FORCETOC__
 +
==='''Language Files'''===
 +
Phoenix Cart is English by default but other Language Packs are available to download.
  
Other Language Packs are available to download - currently Spanish, German, Dutch and Russian - the links to find them on GitHub are shown in the '''''README''''' file in the Phoenix download - download and install now if required.
+
Changes to the text shown can easily be made to localise and personalise as desired.
  
Changes to language files can be made to localise and personalise the shop to suit you.
+
Let's first explain a little about the basic working mechanics of Phoenix Cart.
  
Let's first explain a little about the basic working mechanics of Phoenix.
+
Using a new installation and the main page (home page) as an example, in your browser go to your website to see similar to this:
  
In your browser go to your website, look in the page footer and click the '''''Privacy & Cookie Policy''''' link.
+
<div class="mainpage_box">
 +
[[File:shop.jpg|link=|1500px]]
 +
</div>
 +
 
 +
 
 +
Look in your browser address bar and you will see the page as '''yoursite.com/index.php''' (if it only shows '''yoursite.com''', click the store logo to refresh the page) so this page is named '''index.php'''.
 +
 
 +
Note that most everything in CE Phoenix Cart is modularised so a lot of the text showing on the page will be in language files associated with those modules.
 +
 
 +
As seen in the example, the page could be described in groups of modules.
 +
 
 +
So, on this page, from the top, there are:
 +
*'''navbar''' modules shown in the navigation bar at the top of the page.
 +
*'''content/header''' modules shown just below the navigation bar.
 +
*'''content/index''' modules shown in the body of the page.
 +
*'''layout/index''' modules (also known as '''pi''' modules) shown in the body of the page. These are child modules of a parent content '''modular''' module.
 +
*'''content/footer''' modules shown at the base of the page.
 +
*'''content/footer-suffix''' modules shown below the footer at the bottom of the page.
 +
 
 +
There are more modules in other groups on other pages.
  
This will open the page - you will see that this page is generated by the file '''''privacy.php''''' - this is shown in your browser address bar - the file name is '''''privacy''''' and the file type extension is '''''.php'''''.
 
  
Find this '''''privacy''''' file in your backup folder/directory on your computer <big>'''([[How to Back Up]])'''</big> - you will find it in the top Phoenix folder/directory - all the main pages that show in your shop will be found here.
+
----
 +
==='''Example'''===
 +
There are 4 modules shown in the footer with titles: '''Information''', '''Customer Services''', '''How To Contact Us''' and '''About Us'''.
  
This file contains all the code to make the page display as it does and you would not normally change anything in it - these type of files are generally referred to as '''''core code''''' - it is the mechanics so don't touch it unless you know what you're doing or you will break things!
+
As an example, change the text associated with '''About Us'''.
  
Open '''''privacy''''' with your file editor e.g. '''''<big>[[WinSCP]]</big>'''''. In the code there will be a reference to the text you see on the page - just a code for each different piece of text.
+
To identify the module, first go to [[File:adminnavbarmod.png|link=]] '''Modules''' and click '''Content''' in the list.
 +
 
 +
<div class="mainpage_box">
 +
[[File:modules-content-footer.jpg|link=|]]
 +
</div>
  
<pre><?php
+
It is in the '''footer''' so look in the '''Group''' column list for modules in the '''footer''' group.
/*
 
  $Id$
 
  
  osCommerce, Open Source E-Commerce Solutions
+
It can be seen on the web page that the '''About Us''' section shows last in the '''footer'''.
  http://www.oscommerce.com
 
  
  Copyright (c) 2018 osCommerce
+
'''Text Block''' can be seen as sorted last in the list of modules in the '''footer''' Group so this is the module.
  
  Released under the GNU General Public License
+
<!-- So, on the server navigate to the '''/includes/languages/english/modules/content/footer/''' folder/directory.
*/
 
  
  require('includes/application_top.php');
+
The file, '''cm_footer_text.php''', can be seen there.
  
  require('includes/languages/' . $language . '/privacy.php');
+
In a multi language store, the same file will also be in other language directories, for example, at:
  
  $breadcrumb->add(NAVBAR_TITLE, tep_href_link('privacy.php'));
+
'''/includes/languages/yourLanguage/modules/content/footer/cm_footer_text.php'''
  
  require('includes/template_top.php');
+
Open the language file to see the constants and their values:
?>
 
  
<h1 class="display-4"><?php echo HEADING_TITLE; ?></h1>
+
<div class="mainpage_box">
 +
[[File:modules-content-footer-file.jpg|link=|1500px]]
 +
</div>
  
<div class="contentContainer">
+
The value will be output wherever the constant is used in a file.
  <?php echo TEXT_INFORMATION; ?>
 
  
  <div class="buttonSet">
+
Note: Some language files might have the constants and values written slightly differently like:
    <div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fas fa-angle-right', tep_href_link('index.php'), null, null, 'btn-light btn-block btn-lg'); ?></div>
+
<div class="mainpage_box">
  </div>
+
[[File:constant-define.jpg|link=|]]
 
</div>
 
</div>
 +
-->
 +
Problems finding which file to change? Have a look at <big>'''[[How to Change Text]]'''</big>
  
<?php
 
  require('includes/template_bottom.php');
 
  require('includes/application_bottom.php');
 
?>
 
</pre>
 
  
In this case there are 4 pieces of text so there are 4 codes - <code>NAVBAR_TITLE</code> for the text that shows in the breadcrumb, <code>HEADING_TITLE</code> for the text that shows in the page title, <code>TEXT_INFORMATION</code> for the main text and <code>IMAGE_BUTTON_CONTINUE</code> for the text that shows in the "Continue" button.
+
----
 +
==='''Edit Example'''===
 +
Changes to any language file for the Store side are made to a copy which is saved in a new location in the template directory set in '''Configuration &rarr; My Store &rarr; Template Selection'''. In a new installation this is '''override'''.
  
They are easy to find - these language codes are always written in upper case and if your using the '''''<big>[[WinSCP]]</big>''''' file editor they will be show up as white text.
+
This prevents them being overwritten in updates.
The codes for each piece of text are '''''defined''''' in a statement in a corresponding '''''language file'''''.
 
  
For example, the '''''defines''''' for the text you see will be found in the language file found in '''''includes/languages/english/privacy.php'''''.
+
Changes to any language file for the Admin side are saved in the original location, they cannot be overridden.
  
Note that the language file has the same name as the corresponding main page file.
+
If making a change to an Admin side language file, backup that file before and after making changes to the file on the server.
  
You can find and open this language file from admin - go to '''''Tools → Define Languages''''' and look for '''''privacy.php''''' in the list.
+
In every case, backup files before and after editing.
  
Click to open it and look for the ''defines'' - in this case there will be 3 ''''defines'''' showing as
+
Making a change to a Store side language file (presuming using English):
<pre>define('NAVBAR_TITLE', 'Privacy Notice');
+
*From the admin dashboard go to '''Tools > Language Explorer'''.
define('HEADING_TITLE', 'Privacy Notice');
+
*Look in the list for '''english > modules > content > footer''', click the drop down arrow and see the language files associated with the modules.
define('TEXT_INFORMATION', 'Put here your Privacy Notice information.');</pre>
+
*See '''cm_footer_text.php''' which is the language file associated with the '''Text Block''' module.
 +
*Click it. This will copy the file to your template (which is override in a new install).
 +
*Now a copy of that file will be at /templates/override/includes/languages/english/modules/content/footer/cm_footer_text.php
 +
*Open the new file '''/templates/override/includes/languages/english/modules/content/footer/cm_footer_text.php'''
 +
*See the constant '''MODULE_CONTENT_FOOTER_TEXT_TEXT''' has a value set as <pre><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p></pre>
 +
*In this case, the text is formatted as a paragraph by being wrapped in HTML tags - <pre><p></pre> to start and <pre></p></pre> to end.
 +
*The value is also wrapped in single quotes.
 +
*Change the text as required.
 +
*If you enter any more single quotes in your text, you must use a backslash before the single quote, for example, '''don\'t'''.
 +
*Check and test the changes in the store. Remember to refresh/reload the page to see changes. Back up the file.
  
These '''''defines''''' are for text that shows specifically on the '''''privacy''''' page - the '''''define''''' for the text that shows in the "Continue" button is not in this file because it will show on other pages too - it is found in the main '''''english.php''''' language file.
 
  
The text will show between two single quotes e.g. <pre>'Put here your Privacy Notice information.'</pre>
+
----
Now you have the language file open, change the text between the single quotes and click save.
+
==='''Policy Pages'''===
  
Open the website page again to see your changes or if you still have the page open, refresh or reload the page to see the changes.
+
It is important to enter your own text for the pages that customers will use before and after buying.
 +
 
 +
These are the Policy pages, such as the '''Privacy & Cookie Policy''', '''Terms & Conditions''' and '''Shipping & Returns''' pages.
 +
 
 +
Links to these pages can be seen in the footer of the shop.
 +
 
 +
The text for the content of these pages are handled in an alternative way.
 +
 
 +
The content text is not changed in Language files but is changed from admin - go to [[File:adminnavbartools.png|link=]] '''Tools → Info Pages'''
 +
 
 +
For example, go to '''Tools → Info Pages''' and double click '''Privacy & Cookie Policy''' in the list to edit.
 +
 
 +
Change the text '''Put here your Privacy/Cookie Policies Text.''' to your required text and click <span class="btn-green">Save</span>.
 +
 
 +
The text for the module title, '''Information''' and the text for links to these pages are shown in a module in the footer and are changed in Language files.
 +
 
 +
For example, to change the text that shows '''Information''', find the file '''/includes/languages/yourLanguage/modules/content/footer/cm_footer_information_links.php'''
  
Only ever change the text between the quotes - be sure not to delete one of the quotes by mistake or you will break things!.
+
Follow steps similarly to the Example above to copy into your template folder.
  
Just about every page and module in Phoenix will work this way and have it's own corresponding language file.
+
Open the new file to see: <pre>const MODULE_CONTENT_FOOTER_INFORMATION_HEADING_TITLE = 'Information';</pre>
  
The exceptions are the main language files named '''''english.php''''', there is one for the admin and one for the shop, which control text for many different pages.
+
Change '''Information''' to your required text and save.
  
All of the text can be changed in those '''''define''''' statements to personalise the text or messages displayed.
+
Open the website page again to see your changes or if you still have the page open, refresh or reload the page to see the changes.
  
So remember - you can change anything in a language file define statement between those two quotes.
+
Back up the file.
  
IMPORTANT: If you enter any more quotes in your text, you must use a backslash before the quote e.g. '''''don\'t''''' or you will confuse the system and break things!
+
The text for the links is in the same file.
  
Phoenix is modular meaning some pages are comprised of different modules. In this case the language define will be found in the language file for the module and not for the page. This can make it difficult to find them but to find the language files to change text see - <big>'''[[How to Change Text]]'''</big>
+
For example, see the lines:
 +
<pre>  const MODULE_CONTENT_FOOTER_INFORMATION_DATA = [
 +
    'privacy.php' => 'Privacy &amp; Cookie Policy',
 +
    'conditions.php' => 'Terms &amp; Conditions',
 +
    'shipping.php' => 'Delivery &amp; Returns',
 +
    'contact_us.php' => 'Contact Us',
 +
  ];</pre>
  
At this stage your shop is probably ready to go live but Phoenix can be customised in every way.
+
Change '''Privacy &#38;amp; Cookie Policy''' as required.
  
The next steps show a few common ways that shop owners customise the shop.
 
  
 +
----
 +
==='''Addons'''===
 +
 +
Other Language Packs are published in the '''Addons Library''' where the '''.zip''' files can be downloaded.
 +
*'''[https://phoenixcart.org/forum/app.php/addons/free/language-23 Language Packs]'''
 +
 +
Language Packs are created by and maintained by volunteers so support for them is only available from the author.
 +
<hr>
 +
<span class="btn-grey btn-prev">{{#fas:arrow-left}} [[Change_Logo|Previous Step]]</span>
 +
<span class="btn-grey btn-next">[[Change_Style_and_Color|Next Step]] {{#fas:arrow-right}}</span>
 
<hr>
 
<hr>
<span class="btn-grey">[[Change_Logo|&#129032; Previous Step]]</span>
+
{{Forum}}
<span class="btn-grey">[[Change_Style_and_Colour|Next Step &#129034;]]</span>
+
{{Pro}}
 +
{{Contribute}}

Latest revision as of 10:12, 3 June 2025

Back

Language Files

Phoenix Cart is English by default but other Language Packs are available to download.

Changes to the text shown can easily be made to localise and personalise as desired.

Let's first explain a little about the basic working mechanics of Phoenix Cart.

Using a new installation and the main page (home page) as an example, in your browser go to your website to see similar to this:

Shop.jpg


Look in your browser address bar and you will see the page as yoursite.com/index.php (if it only shows yoursite.com, click the store logo to refresh the page) so this page is named index.php.

Note that most everything in CE Phoenix Cart is modularised so a lot of the text showing on the page will be in language files associated with those modules.

As seen in the example, the page could be described in groups of modules.

So, on this page, from the top, there are:

  • navbar modules shown in the navigation bar at the top of the page.
  • content/header modules shown just below the navigation bar.
  • content/index modules shown in the body of the page.
  • layout/index modules (also known as pi modules) shown in the body of the page. These are child modules of a parent content modular module.
  • content/footer modules shown at the base of the page.
  • content/footer-suffix modules shown below the footer at the bottom of the page.

There are more modules in other groups on other pages.



Example

There are 4 modules shown in the footer with titles: Information, Customer Services, How To Contact Us and About Us.

As an example, change the text associated with About Us.

To identify the module, first go to Adminnavbarmod.png Modules and click Content in the list.

Modules-content-footer.jpg

It is in the footer so look in the Group column list for modules in the footer group.

It can be seen on the web page that the About Us section shows last in the footer.

Text Block can be seen as sorted last in the list of modules in the footer Group so this is the module.

Problems finding which file to change? Have a look at How to Change Text



Edit Example

Changes to any language file for the Store side are made to a copy which is saved in a new location in the template directory set in Configuration → My Store → Template Selection. In a new installation this is override.

This prevents them being overwritten in updates.

Changes to any language file for the Admin side are saved in the original location, they cannot be overridden.

If making a change to an Admin side language file, backup that file before and after making changes to the file on the server.

In every case, backup files before and after editing.

Making a change to a Store side language file (presuming using English):

  • From the admin dashboard go to Tools > Language Explorer.
  • Look in the list for english > modules > content > footer, click the drop down arrow and see the language files associated with the modules.
  • See cm_footer_text.php which is the language file associated with the Text Block module.
  • Click it. This will copy the file to your template (which is override in a new install).
  • Now a copy of that file will be at /templates/override/includes/languages/english/modules/content/footer/cm_footer_text.php
  • Open the new file /templates/override/includes/languages/english/modules/content/footer/cm_footer_text.php
  • See the constant MODULE_CONTENT_FOOTER_TEXT_TEXT has a value set as
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
  • In this case, the text is formatted as a paragraph by being wrapped in HTML tags -
    <p>
    to start and
    </p>
    to end.
  • The value is also wrapped in single quotes.
  • Change the text as required.
  • If you enter any more single quotes in your text, you must use a backslash before the single quote, for example, don\'t.
  • Check and test the changes in the store. Remember to refresh/reload the page to see changes. Back up the file.



Policy Pages

It is important to enter your own text for the pages that customers will use before and after buying.

These are the Policy pages, such as the Privacy & Cookie Policy, Terms & Conditions and Shipping & Returns pages.

Links to these pages can be seen in the footer of the shop.

The text for the content of these pages are handled in an alternative way.

The content text is not changed in Language files but is changed from admin - go to Adminnavbartools.png Tools → Info Pages

For example, go to Tools → Info Pages and double click Privacy & Cookie Policy in the list to edit.

Change the text Put here your Privacy/Cookie Policies Text. to your required text and click Save.

The text for the module title, Information and the text for links to these pages are shown in a module in the footer and are changed in Language files.

For example, to change the text that shows Information, find the file /includes/languages/yourLanguage/modules/content/footer/cm_footer_information_links.php

Follow steps similarly to the Example above to copy into your template folder.

Open the new file to see:

const MODULE_CONTENT_FOOTER_INFORMATION_HEADING_TITLE = 'Information';

Change Information to your required text and save.

Open the website page again to see your changes or if you still have the page open, refresh or reload the page to see the changes.

Back up the file.

The text for the links is in the same file.

For example, see the lines:

  const MODULE_CONTENT_FOOTER_INFORMATION_DATA = [
    'privacy.php' => 'Privacy & Cookie Policy',
    'conditions.php' => 'Terms & Conditions',
    'shipping.php' => 'Delivery & Returns',
    'contact_us.php' => 'Contact Us',
  ];

Change Privacy &amp; Cookie Policy as required.



Addons

Other Language Packs are published in the Addons Library where the .zip files can be downloaded.

Language Packs are created by and maintained by volunteers so support for them is only available from the author.


Previous Step Next Step


Many Addons and Extensions available in the CE Phoenix Cart Addons Library

If help is needed, support is available in the CE Phoenix Cart Support Forum

Phoenix Cart User Guide, like CE Phoenix Cart, is free to use but is maintained by unpaid volunteers.

Code references are licensed under a Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
All other content is the reserved Intellectual Property and Copyright of phoenixcart.org