Jump to content

How to debug language issue?


benjAeby

Recommended Posts

Hello,

I use cubecart since 2017 for an artisanal bio soap company (https://www.savonnerie-neptune.ch/) with 2 languages : french and german. I now have issue with language : only the english common sentences are displayed, regardless to the selected language. Document and product details are ok in the selected language.

I already tried:

- clear caches

- changed default language for cubecart

- reinstall languages packs + add english US for tests

- checked the config (b64 encoded) : all seems ok, english, french and german are in the json string, active.

- changed the skin (foundation -> basix -> foundation -> tweaked basix...)

- Cubecart is up to date : 6.5.1.

Could someone help me to debug this?

Regards

Edited by benjAeby
Link to comment
Share on other sites

You said, "english, french and german are in the json string". I do not see the list of enabled languages as part of the general configuration setting string.

In admin, Languages, confirm the Status setting of all installed languages.

Link to comment
Share on other sites

Hi,

In the admin/languages:

- French and German are enabled. - English UK and English are disabled.

On front-end, flags and language is OK and documents are displayed in the selected language. The issue is about all common sentences ("Shop by category"...) in English only.

 

Link to comment
Share on other sites

CubeCart should load the language strings from definitions.xml (which are UK-based), then overload that array with strings found in the chosen language pack. (Note that the "en-US.xml" file has only five strings for common US terms.)

The language packs are not kept up to par as new strings are added to definitions.xml (for new features). But more than 99% of the language strings are common all the way back to CC5 - so, very nearly all of present-version CubeCart should show the correct language strings.

One would need to do a deep dive into the CubeCart code to see if/where the problem lies.

I see that your skin (savonnerieNeptune) is derived from Basix. Please post the contents of the skin's template "box.search.php" (use a code window - the <> tool on this editor will show a code editing box).

 

Link to comment
Share on other sites

Here is the content of box.search.php (unmodified from Basix):

{*
 * Basix CubeCart Template
 * ========================================
 * Basix is a template developed by NiteFox 
 * also known as NiteTower Design.
 * ========================================
 * Web:        https://www.facebook.com/CubeCartThemes
 * Email:      nitetowerdesign@gmail.com
 * License:    http://nitefox.x10host.com/license.html
 * Disclaimer: http://nitefox.x10host.com/disclaimer.html
 *}

<form action="{$STORE_URL}/search{$CONFIG.seo_ext}" class="search_form" method="get">
	<div class="input-group search_container">
		<input name="search[keywords]" data-image="true" data-amount="15" type="text" class="form-control search_input{if $CONFIG.elasticsearch=='1'} es{/if}" placeholder="{$LANG.search.input_default}" autocomplete="off" required>
		<div class="input-group-btn">
			<button class="btn btn-default" type="submit" value="{$LANG.common.search}"><i class="fas fa-search"></i></button>
		</div>
	</div>
	<input type="hidden" name="_a" value="category">
</form>

 

Link to comment
Share on other sites

So, this is from the skin "savonnerieNeptune" - which is based on Basix, and has had no customizations made to it.

Then, we need to find why the Smarty variable $LANG has arrays that are not correct.

Please use an external database utility to directly view the table CubeCart_lang_strings. (Your hosted account's control panel should have phpMyAdmin to do this.) How many rows of data are there, and if there are any, do the phrases in the 'value' column not match the language code in the 'language' column?

Please examine the file in /language/ folder named 'de-DE.xml'. Please post the first 40 lines into a code window.

Is there any other file in the /language/ folder that has de-DE in the filename?

 

Edited by bsmither
Link to comment
Share on other sites

The table "CubeCart_lang_strings" has only one row. This row is the german value for "Add to basket" -> "Hinzufügen", which is displayed correctly when german language is selected.

Here are the 40 first lines of "de-DE.xml":

<?xml version="1.0" encoding="UTF-8"?>
<!--
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2014. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  [email protected]
 * License:  GPL-2.0 http://opensource.org/licenses/GPL-2.0
-->
<language version="2.0">
 <info>
  <title><![CDATA[Deutsch]]></title>
  <code>de-DE</code>
  <character_set>utf-8</character_set>
  <version>2.0.0</version>
  <minVersion>5.0.0</minVersion>
  <maxVersion>6.*.*</maxVersion>
  <default_currency>EUR</default_currency>
  <text-direction>ltr</text-direction>
  <override/>
 </info>
 <translation>
  <group name="account">
   <string name="already_registered"><![CDATA[Bereits registriert?]]></string>
   <string name="contact_details"><![CDATA[Kontaktinformationen]]></string>
   <string name="create_account"><![CDATA[Ich möchte ein Benutzerkonto anlegen]]></string>
   <string name="download_count"><![CDATA[Downloads]]></string>
   <string name="download_deleted"><![CDATA[Dieser Download ist nicht mehr verfügbar.]]></string>
   <string name="download_expired"><![CDATA[Abgelaufen]]></string>
   <string name="download_expires"><![CDATA[Läuft ab]]></string>
   <string name="enter_validation_key"><![CDATA[Bitte geben Sie nachfolgend Ihre E-Mail-Adresse und den Verifizierungscode ein und wählen Sie dann ein neues Passwort]]></string>
   <string name="error_address_added"><![CDATA[Adresse konnte nicht gespeichert werden.]]></string>
   <string name="error_address_billing"><![CDATA[Bevor Sie fortfahren können, müssen Sie eine Rechnungsadresse eingeben.]]></string>
   <string name="error_address_delete"><![CDATA[Adresse konnte nicht gelöscht werden.]]></string>
   <string name="error_address_not_found"><![CDATA[Adresse konnte nicht gefunden werden.]]></string>
   <string name="error_address_updated"><![CDATA[Adresse konnte nicht aktualisiert werden.]]></string>
   <string name="error_details_updated"><![CDATA[Ihre Informationen wurden nicht aktualisiert.]]></string>

There is one other file with de-DE in the filename : "email_de-DE.xml". Here are the first lines:

<?xml version="1.0" encoding="UTF-8"?>
<!--
 * CubeCart v6
 * ========================================
 * CubeCart is a registered trade mark of CubeCart Limited
 * Copyright CubeCart Limited 2014. All rights reserved.
 * UK Private Limited Company No. 5323904
 * ========================================
 * Web:   http://www.cubecart.com
 * Email:  [email protected]
 * License:  GPL-2.0 http://opensource.org/licenses/GPL-2.0
-->
<emails version="2.0" language="de-DE">
  <email name="admin.password_recovery">
    <subject><![CDATA[Admin-Passwortwiederherstellung]]></subject>
    <content type="html"><![CDATA[<p>Sehr geehrte/r {$DATA.name},</p> 
        <p>um wieder Zugriff auf die Administrationsbedienkonsole des Shops zu bekommen, folgen Sie bitte dem nachfolgenden Link:</p> 
        <p><a href="{$DATA.link}">{$DATA.link}</a></p> 
        <p>Wenn der obige Link nicht funktioniert, kopieren Sie Ihn bitte in die Adressleiste Ihres Browsers.</p>]]></content>
    <content type="text"><![CDATA[Sehr geehrte/r {$DATA.name},
        
        um wieder Zugriff auf die Administrationsbedienkonsole des Shops zu bekommen, folgen Sie bitte dem nachfolgenden Link:
        
        {$DATA.link}
        
        Wenn der obige Link nicht funktioniert, kopieren Sie ihn bitte in die Adressleiste Ihres Browsers.]]></content>
  </email>
  <email name="cart.order_complete">
    <subject><![CDATA[Bestellung fertiggestellt]]></subject>
    <content type="html"><![CDATA[<p>Hallo {$DATA.first_name},</p> 
        <p>wir freuen uns, Ihnen mitteilen zu können, dass Bestellung Nummer {$DATA.cart_order_id} fertiggestellt wurde. Wenn Sie materielle Waren bestellt haben, sollten sie in Kürze ankommen.</p>]]></content>
    <content type="text"><![CDATA[Hallo {$DATA.first_name},
        
        wir freuen uns, Ihnen mitteilen zu können, dass Bestellung Nummer {$DATA.cart_order_id} fertiggestellt wurde. Wenn Sie materielle Waren bestellt haben, sollten sie in Kürze ankommen.]]></content>
  </email>
  <email name="cart.order_cancelled">
    <subject><![CDATA[Bestellung storniert]]></subject>
    <content type="html"><![CDATA[<p>Hallo {$DATA.first_name},</p> 
        <p>Bestellung Nummer {$DATA.cart_order_id} wurde storniert.</p>]]></content>
    <content type="text"><![CDATA[Hallo {$DATA.first_name},

 

Link to comment
Share on other sites

"the database table" ==> Good, seems to be no problem here.

"the language file" ==> I have version 1.0.0 - will need to check version 2.0.0.

"other files" ==> Good. I expect to see the email file. But no sub-file for that language.

When CubeCart sends an email, does the content of that email appear in either de-DE or fr-FR, or do they, as well, appear in English?

Does the admin section appear in English as well?

Link to comment
Share on other sites

"emails are in french" ==> Good.

"admin is in french" ==> Ok, good.

In admin, Store Settings, Advanced tab, enable the Debug mode. Enter your local IP address (www.showmyip.com) in the next text entry field.

Debug mode will have CubeCart create code that the browser will want to show in a popup-window. Allow the popup. (You may need to close that popup and reload the page to get the correct data to show.)

The debug data will show any errors that PHP encountered, and will show some data from SESSION:. In the '__client' sub-array, what is the value for the 'language' key when viewing the storefront.

(If using the Firefox browser, you may need to close the popup window before requesting the next page.)

Link to comment
Share on other sites

Here is the beginning of SESSION :

SESSION:
'__client' =>
'ip_address' => ***.***.***.***
'useragent' => Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
'session_start' => 1693519342
'session_last' => 1693519347
'language' => de-DE
'currency' => CHF
'admin_id' => 2

The language variable is defined

I have some php warnings:

Quote

.../classes/autoloader.class.php:93 - file_exists() [function.file-exists.php]: open_basedir restriction in effect. File(/usr/share/pear/smarty_autoloader.class.php) is not within the allowed path(s): ...

 

Link to comment
Share on other sites

So, the 'language' key says you (admin #2) want to use de-DE, but the admin is actually showing fr-FR?

In admin, PHP Info, scroll to the Core table, and find include_path.

If /usr/share/pear/ appears in the Local Value or Master Value, the hosting provider support will need to help you resolve the 'open_basedir' conflict.

However, I think is not the cause of this issue.

 

Link to comment
Share on other sites

The errors reported in the log are about open_basedir:

[<strong>Warning</strong>] /home/httpd/vhosts/asaeby.ch/savonnerie-neptune.ch/classes/autoloader.class.php:96 - file_exists() [<a href='http://docs.php.net/manual/en/function.file-exists.php'>function.file-exists.php</a>]: open_basedir restriction in effect. File(/usr/share/php/Smarty_Autoloader.php) is not within the allowed path(s): (/home/httpd/vhosts/asaeby.ch/savonnerie-neptune.ch/:/tmp/)

 

Link to comment
Share on other sites

Enabled plugins are:

-All in one shipping [1.0.26]

- Google analytics [1.1.1]

- Paypal commerce platform [1.8.7]

- Print order form [1.3.0]

 

No snippets.

I have no more open_basedir errors in debug since I set open_basedir to none in hosting settings.

 

All sentences are listed in the admin language edition menu. Modified sentences (records in table Cubecart_lang_strings) are displayed in the selected language. All unmodified sentences are displayed as in definitions.xml

Edited by benjAeby
Link to comment
Share on other sites

Using a programmer's text editor, make the following change to the file /classes/language.class.php:

Near lines 234-237, find:

    public function assignLang()
    {
        $GLOBALS['smarty']->assign('LANG', $this->_language_strings);
    }


Change to:

    public function assignLang()
    {
        $GLOBALS['smarty']->assign('LANG', $this->_language_strings);
        $GLOBALS['debug']->debugMessage('Assigning language strings to Smarty LANG. Example ('.$this->_language.'): '.$this->_language_strings['account']['already_registered'].'<br><pre>'.print_r(debug_backtrace(0),true).'</pre>');
    }

Be sure to have CubeCart's debug mode enabled.

View the Homepage.

Near the bottom of the debug window, there will be a section showing Debug Messages:.

Copy that section to a reply. (You can reply in a PM if you wish.)

Link to comment
Share on other sites

Hm. We can see that right away CubeCart is told to use fr-FR, but the phrases are not coming from that language pack. (See Debug Messages[0])

Please examine the following and try the suggested action:

In admin, Languages, take note of any actual entries in the Domain column (not the slightly greyed-out suggested examples).

If there are actual entries, blank them out and Save.

Have CubeCart clear its internal cache.

Did anything change?

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...