Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can i disable one language in admin pages of oscommerce?


g_p_java

Recommended Posts

Posted

Hello i have oscommerce v.2.3.1 and in admin pages under

Localization--> Languages i have installed two languages.

 

Now, i need only one language enabled in my website.

In order to achieve that, i deleted one of the two languages under

Localization--> Languages in admin pages.

 

But i noticed that it didn't work cause in users' pages i had some issues with application_top.php file.

 

Is there any other way to disable one of the two languages in oscommerce?

Or how can i enable only one language in oscommerce instead of two?

 

Thanks, in advance

Posted

Hello g_p,

 

Have you tried to remove the relevant files under /includes/languages/ ?

Say you'd want to remove the Dutch language, you should remove includes/languages/dutch.php and the folder includes/languages/dutch/, next to the removal in the admin section.

 

Also, make sure that the relevant files for the remaining language(s) is (are) present and that your product/category info is present in that (those) language(s).

 

If you get an error message, it's always helpful to mention it here too...

Posted

Should I mention this?

 

BACKUP first! (files and database)

Posted

Thanks for replying,

 

i did that and i get the following warnings when i try to login in admin pages,

so i can't enter the admin pages

 

Warning: require(includes/languages/english.php) [function.require]: failed to open stream: No such file or directory in catalog\admin\includes\application_top.php on line 167
Fatal error: require() [function.require]: Failed opening required 'includes/languages/english.php' (include_path='.;C:\php5\pear') in catalog\admin\includes\application_top.php on line 167

 

So, it's not working

Posted

I don't know if this is the right way, but what i did was to delete english language in catalog(in admin).

For admin i just copy the english language and the language php file to my new language. Due to lack of complete translation and i dont mind using english in admin.(But it will still be language_id 1)

 

In phpmyadmin i changed the languages table so that language_id 1 is Norwegian. Just edit the fields to reflect your language.

Then the hole shop is in one language only, both in catalog and admin. English removed.

 

INSERT INTO `languages` (`languages_id`, `name`, `code`, `image`, `directory`, `sort_order`) VALUES
(1, 'Norwegian', 'no', 'icon.gif', 'norwegian', 1);

 

You might have to translate order status as this will still be in english.

Posted

thanks for replying,

 

my basic language is already inserted in the languages table with sort_order = 1 , so there is no need for me to insert it again.

 

But i have english language as well.

 

Instead of deleting the language in the admin pages,

i modified the file includes/modules/boxes/bm_languages.php

 

This file displays the languages box and the flags.

So i inserted comments in the icon.gif flag that i don't want to appear on my website

Posted

The admin language is determined by this code in application_top.php:

// set the language
if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
 tep_session_register('language');
 tep_session_register('languages_id');
}
include(DIR_WS_CLASSES . 'language.php');
$lng = new language();
if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
 $lng->set_language($HTTP_GET_VARS['language']);
} else {
 $lng->get_browser_language();
}
$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
}

 

The language class is responsible for retrieving the various details of the chosen language upon initialization and for retrieving the languages supported by your browser (it picks the first one present in your database).

If you follow the code lines above, then you'll see that the following lines determine the language to be used:

 

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
 $lng->set_language($HTTP_GET_VARS['language']);
} else {
 $lng->get_browser_language();
}

 

Translated: if the language is specified by a URL parameter (not your case), then set that language.

Else: get the language supported by the browser. I bet this is your case and it is English (most browsers support English by default).

 

So the language is set to English and on line 167, it tries to load the english.php file.

 

What you can do:

1. Make sure that Norwegian is present in your database: 1 Norwegian no icon.gif norwegian 1

and that the relevant language files and directories are present;

2. Add the following to your URL: ?language=no

 

This should work.

 

If you intend to change the language id, make sure that you change it in all tables using a language id (like categories_description, languages, orders_status, products_description, product_options, product_options_values, reviews_description).

 

Good luck!

Posted

You do not need to delete any files, you can delete all languages but 1 and then make sure you set that language as the sites default language.

 

You can find info on languages settings here..

Posted

Thanks for replying, the default language in this way, is not working in my website.

 

Unfortunately my code considers the default language of the browser

and that's not good for me.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...