Jump to content

-Solved- Problem creating a new language


Izraelviz

Recommended Posts

I am trying to create a new language, but I cant seem to figure it out why it's not working. Basically I want to create a Norwegian language. I add the little info I am suppose to, hit save, and the languages turns a little crazy on me. New language picture is "unknown", text says "Norsk" and language is enabled, but cant edit. When I go to Store front, i get "Norsk" as text, but with the German flag.  Now I am also unable to delete the language from back office. Anyone familiar with this behaviour?

Elviz

Link to comment
Share on other sites

In Foundation, this skin uses one image to show the flags of the languages. It is at /skins/foundation/images/sprite_flags.png.

The nature of a sprite image is that CSS will allow only a part of the entire image to be seen through a "window". The position of the window is fixed, but the position of the sprite image is positioned exactly where the desired part can be seen.

So, here is what I suggest:

Download CC5217. In that package, look in the /images/flags/ folder. (CC6 does not ship with all these flag images.) Copy out the flag you need.

Save this flag image in /language/flags/.

Then, using an image editor, load in the sprite image, adjust its "canvas size" to add more room at the bottom, then paste in the image of the new flag. Save.

Then, in /skins/foundation/css/cubecart.css, near lines 224-233, add another rule that follows the above rules' syntax, with -110 as the last value. Save.

This makes the flag available on the storefront (Language Selector), and in admin when editing the language.

Send me a Private Message (include your email address) if you need help with any of this.

Link to comment
Share on other sites

Thank you for replying bsmither. Appreciate it.

This should be fairly easy, but it doesn't really solve the main issue here, wich is the problem(s) in the BO. =)

It's the creation of the language and translations itself that seems to be failing. At least I cant figure it out

Link to comment
Share on other sites

Copy all the files that were created in the /languages/ folder to your local computer. Just for backup. Then clear those files from that folder.

We will start fresh.

In admin, Languages, Create Language tab:

Language Name: Norwegian Bokmål (or spell it according to how a Norwegian would spell it)
Language Code: no-NB
Parent Language: --None--

Save.

Copy the file from CC5217 /images/flags/no.png to your site (same folder).

Now you need to decide how to create the language strings: by editing the actual language file, or by entering the phrases in CubeCart's Language Editor.

Let me know how the above instruction goes.

Link to comment
Share on other sites

Still acting odd. I.E when I try to disable the new language, it automaticly ticks itself again when hitting save. And it does not respond to the "Edit" button. I see there is a languge fix in 6.1.1. I'll do an update\clean install and see if that helps.

Link to comment
Share on other sites

"I try to disable the new language, it automatically ticks itself again when hitting save."

Do you get a red or blue banner just below the tabs after deselecting a language and clicking Save?

The blue banner will say: Language status successfully updated.

If you do not get a red/blue banner on the returned page after clicking Save, then make sure the admin that is signed in has permission to make changes to the store settings. (It's a long-shot, but the code has that test.)

There isn't a database table with languages enabled, per se. CubeCart maintains a list of the language's statuses in its Config database table. And the only place where setting the languages statuses is when Saving from that list of languages.

So, I think somehow, the language config array is not getting saved to the 'languages' record in the CubeCart_config database table.

Using an external database utility, directly view the contents of CubeCart_config where the column 'name' is "languages". Take the value found in the column 'array' and run it through a base64 decoder.

Link to comment
Share on other sites

When I untick the language and hit save, I get the blue banner telling me it's a success. But the checkbox also gets auto ticked. Super user is in the admin is checked.

 

When I run the CubeCart_config in a decoder i get this: {"0":"0","en-GB":"1"}

Link to comment
Share on other sites

Looks like you were on to something after all regarding the sprite image, bsmither. I somehow, in a strange way, got it working. Here's what i did:

1. Opened the image sprite and replaced the bottom flag with the Norwegian.

2. Changed span.flag.flag-PT to span.flag.flag-NO.

3. Downloaded the Danish language files and changed every text saying dk-DK to no-NO.

4. Added the Norwegian flag to the language folder in root.

Now the language automatically showed up in both BO and store front (with the right flag)

Have no clue whatsoever why the sprite image should be the one that screwed this up bigtime in the backoffice, but now everything seems to be working.

This said: Isn't this quite poor management of the language options? I remember having the same issues back in 6.0.6 or something, and the result of it was that I dropped CubeCart and moved on to other eCommerce solutions. 

My two speciedalers at least

Elviz

Link to comment
Share on other sites

{"0":"0","en-GB":"1"}

That first "0" should be the code of a country, probably "no-NO", or whatever you entered when using the Create Language tab.

So, I think a few issues here that needs examining:

1. User input (country code) is not validated,
2. Corrupted data is not fixed, and
3. The newly created language file may have some internal syntax problems.

 

Link to comment
Share on other sites

I've posted several issues in the Github.

I think I solved part one of a three-part problem:

1. Wrong syntax sending data to be set in the Config
2. Config not accepting false values to be set
3. The language file created is missing data - won't get enumerated later

More work to follow.

Link to comment
Share on other sites

Ok. Points 1 and 3 are working, but point 2 is not, meaning the new language will be enabled, even though the "Create Language" code's intention is to have the newly created language default to disabled.

If you have the ability to make edits to the code (you don't have to understand what the edits do, you just have be detail-oriented), follow the suggestions in these issues posted in the Github: Creating Language Setting to Config has Wrong Syntax, Creating Language Creates Bad Header Info for File, Creating Language Additional Data for Language File.

 

Link to comment
Share on other sites

HUGE IMPROVEMENT! Works like a charm!

I wasn't quite sure if I should change this line though, so I didn't:

 

But if 276 is, in fact, 'parent_language' coming from $array['parent'], then the value will be a language code and the statement should be:

$xml->setElement('parent_language', $array['parent'], false, false);

I did not get an "email_xx-XX.xml" in the language folder though, but maybe this file is created elsewhere, yeah?

Link to comment
Share on other sites

Good point.

I see nothing in the Create Language code that would copy over an existing email language file.

But, email templates are 100% databased (loaded into the database during setup from the email files), as opposed to the phrases in the language files (only changed phrases are databased).

Now that CC is aware of a new language, in admin, Email Templates, click the white plus in green circle to start translating emails into that language.

Also, don't forget about the flag image situation as discussed earlier. Again, if you need help with adding the flag image to the sprite, let me know. And the CSS rule edit for Foundation.

Link to comment
Share on other sites

I got the css tweaking and sprite modification under control, so I'm good there. Thanx for reacing out a hand though =)

I will most likley need help with other stuff down the road though, as my skills are basically restricted to things like css and sprite modifications. Database-export and import from PrestaShop to CubeCart might give us some headache. ;)

It's pretty awesome that you guys are on top of things right away with solving issues + being so helpful in the forum. A huge plus when deciding what to go for.

Both thumbs up!

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...