Translating a Magento shop

Been doing some translation for a shop built with Magento we wanted to try a French version of. For now it uses automated translation, in the future if it proves worthwhile we could move it to using a real translation.
I’m not a French speaker so its difficult to tell how good the machine translation is but we think its probably good enough to prove the feasibility of the scheme. Subtleties about French in France and French in Canada are a bit beyond us, but we are aiming at the French in France.

We made the French shop a Store View so it shares the same stock and pages as the main site but under a different domain name. Which seemed the simplest way.

Technically

We add the text block to a list of the product texts when the English text is altered. Then a PHP script goes through recently altered texts and gets the translation of that text in French. We also have a local translation cache somewhat inspired by, but much simpler than the Etsy scheme. This way we can save translating strings that have already been translated. In the shop I’m working on the short descriptions and full descriptions for products are actually the same so there no point translating them twice.

We are using Bing translate because their API seemed to make sense and they had a large free tier (2 million words) I could try stuff out on. It seems very solid technically it always seems to be there and hasn’t caused any issues so far. They also have a wide range of languages if your doing something more esoteric including Klingon ( pe’el maH roj ).

It was originally built on the Data Marketplace and now switched over to the newer Azure where its a bit hidden on portal.azure.com under Intelligence + Analytics > Cognitive Services API. If you have trouble creating an account / subscription I found they don’t like things they regard as prepaid cards, but don’t say that instead putting up a ‘problem with your account contact support’ message. Debit cards seem to work.

Magento makes translation not too technically demanding, basically you add alternative language versions of your CMS pages like contact us, about us, shipping, terms and conditions etc. Then you go through your various templates and check for any strings not in tags like this __(‘In Stock’); ?>
The strings are then looked up in the corresponding language files under app/etc/locale/fr_FR. If you haven’t got the language pack you can take a look on the Magento connect site and use one of those as a basis. Things that still come up in English need adding to the .xml files in lines
‘base language’, ‘translation’
style like
“Free”,”Gratuit”. There is lots of going through pages and checking for little English chunks.

You’ll also need to create/edit a switch template to allow users to switch languages and or currencies. In the way you want it to work and that is simple for the visitor to the site to use.

This was all in Magento 1.x;

Scumbags, Idiots and Charlatans

In the last few weeks experienced a lot of client abuse on the interweb.
Customers paying through the nose for web development and just being ignored.
Customers being abandoned.

I’ve been picking up the pieces for a couple of people and it makes me feel kind of sad its just that there isn’t any need for it. Ok things change and that is fine the web developer is not married to the customer and if you don’t have the skills in house to support them then that is fine but say that.

Not all customers are super technical and some need more hand holding than others many are actually frustrating.

But there isn’t any excuse really for treating people that badly. Building web stuff is a people business your coding stuff that will be used by humans in order to fulfil aims that other humans have. Whilst people are sometimes difficult and irritating and occasionally just downright maddening. Its developers job to help them, not impose stuff on them or extract money for nothing or exploit their lack of knowledge. If you can’t get on say that and leave them. Don’t just ignore them, you could even help them find someone new to sort things out.

Increasing font size in your browser

I was working on mobilizing a site recently and was asked about font sizes. Also was talking to someone who was ordering tablets for staff because everyone could read them because of screen size.
Traditionally you could put increase font size buttons on a site then store it in the session. I’ve done this in the past on public sector sites that were insistent on passing WCAG and WAI guidelines. While that is well intentioned I’m not sure its a great way of sorting out the problem or even passing the intention of the guidelines.
Users don’t want to be pressing an increase font size button on each site they visit that may or may not be there and is going to be in a different position on each site. It seems better for users to control font size in their browser either permanently or with the browser on an odd page. That way it is stored and more permanent.
Their eyesight isn’t going to change from website to website, barring laser eye surgery in your lunchtime.

That said its worth bearing in mind when designing sites everyone benefits from clear text and a site layout that stays readable even with the text resized according to browser preferences. Not only the middle aged or people with reduced vision but the tired eyed genius teenage programmer of stereo type.

The BBC offers good guides on text resizing if your trying to setup a browser for someone else.

Can I eliminate all errors?

Trying to move towards a zero tolerance for errors.

  • Even minor errors can obscure more major ones
  • Any error could be cancelling out another error – a kind of error ridden hell to avoid at all costs
  • Errors that seem insignificant now may be come more major issues in the future (when deprecated becomes removed for example)
  • Broken windows – lead to more broken windows.
  • Errors annoy me
  • Its hard to take any pride/pleasure in code that has even minor errors.
  • Every error is an opportunity to improve code
  • The cost of dealing with errors later is likely to be more
  • Errors can be an opportunity for a hacker to gain information about your system
  • Every error is an opportunity to learn – if you had understood it completely before that error would never have happened.
  • Errors cascade and create other errors

Its better to preempt problems before they occur in the wild. Users shouldn’t have to deal with errors or experience their side effects. Its better for the clients site and whats good for them is good for me (eventually). Its probably impossible to eliminate all but you can squash all the ones you know about. At least with every site reporting all errors however minor to a central source, any that occur over night can be sorted out by breakfast.

Having said that going through 404 logs does make you paranoid. There are bots out their trying to get you :). No really there are.

Stop Users using Stupid Passwords

Been some discussion recently on the WPUK mailing list after some recent mass attacks on WordPress Sites. Lots of good advice from people.

  • Do you need to to allow access from all IP’s
  • Do you need to be able to login all the time or can you say they never login a 2am in the morning so we can stop login at that time.
  • Keep up to date obviously
  • Changing default locations of login pages, wp-admin etc
  • using two factor authentication (yubikey mentioned)
  • captchas on login screen
  • blacklisting of visitors by IP address
  • renaming the default ‘admin’ user

All suggestions worth considering depending on your circumstances.
Someone mentioned about a user with a password of ‘password’, I wondered if there was a way of preventing users injuring themselves by using such a password. By default my current WordPress 3.5 allows a user to do pretty stupid stuff like create a user with a username of ‘e’ and a password of ‘password’.

Not added in list popular passwords that would pass as secure should do that. Could probably extend to exclude dictionary words not sure if its worth doing that.

Dave of interconnect.it mentioned a plugin called ‘better-wp-security’ which does quite a few other things as well, seems worth looking at, Dave had had it recommended to him. There are also a few similar plugins with more restricted scope that just stick to the password ‘force-strong-passwords’ and
‘enforce-strong-passwords’.
I’ve not tried these so I can’t recommend them, I bashed out my own because I was interested. Its probably not quite so client friendly as its called ‘Stop users using stupid passwords’, might have to rename that.

Seems something worth checking on especially as you create a new site. If the password isn’t towards the top of the list of ones a bot attacker might try, it will at least take them longer. Will also stop a human guessing it quite so easily as well.

When its all gone wrong

Sometimes your relationship with your developers can go wrong. What happens if they won’t do anything or won’t enable you to update your site?
Here are some terms its helpful to understand when sorting out the mess. Then some pointers on moving your email and moving your website.

DNS

DNS is the system that tells the internet where to look when someone types in your domain name.
Say your companies website is at www.example.com. When you type www.example.com into your web browser, your computer does a search and finds the IP address for that domain name. Its like sign posting system. This makes it quite crucial, if you can get control of your DNS you can point visitors to your site and emails to your anything@example.com to a new provider.

DNS records are a complicated subject but there are two main types

  • MX records – where your email is
  • A name records – where your website is

IP Address

The address of your server as seen by your computer so like 192.0.43.10 or 2001:500:88:200::10: pointed to by your DNS.

CMS

Content management system – the system that allows you to edit your site examples include WordPress, Joomla, Drupal, DotNetNuke, Umbraco, Django, Mura, etc, etc.

Moving your email

The things you will need to know to move your email to new provider are really just the list of email addresses. If you have the existing details (password, username, incoming server) that is ideal as you can use them to pull over any email from the old server.

Moving your website

This is a bit more variable, if you have a static site. It is just a bunch of files all of which are publicly available. So you can grab them or your friendly developer or hosts can.
If you have a dynamic site that has a database and some server side languages it is more difficult. For these the source code isn’t the same as what you can see so you have more difficulties. These sort of sites usually have pages that end with extensions other than .html or .htm for example (.php,.aspx,.cfm) or sometimes with no extension at all like example.com/my-monkey-submarine.

You can make a static copy of a dynamic site as you would for a static site but you do lose any CMS and the information that was in your database that wasn’t publicly viewable.

The vast majority of the time its not like this your existing developer will give you the raw files and database (that is the ideal case). Its your information, you paid for it and you should own it.

Your super idea

Everyone has brilliant ideas in the bath sometimes they even look good in the daylight. (see Archimedes)
You may be a bit hesitant to tell anyone about your idea. Here are some simple things you can do on your own to check out its viability.

  • Do some Google searches around your idea, is anyone else doing something similar?
  • Not to worry you don’t have to reinvent the wheel just have a different spin on it most businesses aren’t revolutionary more evolutionary.

  • Try it out on a few trusted friends, your spouse, partners
  • Have a look at domain names are they available for your idea, if people are using a similar name to what your thinking are they doing a similar thing to your idea.
  • Find someone who could be a potential client/customer ask them what they think.

Telling other people about your idea is a quick way of trying stuff out. You evolve your idea just by repeating it to people and gauging their reaction. Are they getting it or are they struggling to understand what your going on about.

You probably think everyone is going to run off with your precious new idea, to be honest they are more likely to just forget it. Also any enterprise is a lot more than just the idea, the execution is the majority of it. Did Microsoft become dominant because the were the best at original ideas or because they were good at execution?

Then you could try prototyping your idea, build a little prototype website only a cheap thing just a day or so in cost perhaps. Hold a test event. See if anybody is interested, really.

Maintenance

Picking up a website today to add in an advert. Found that no maintenance had been done on the site for five or six years, also there were no backups. As you would expect there were a few things needing fixing. Seems odd really you wouldn’t expect your car to last that long without servicing it, even if it was just cleaning it. Perhaps maintaining your site slightly more frequently would incur less costs than a big bang “oh my god its all fallen apart”.

Guess it depends how important your site is to you, if it went bang! and off for a few days due to a big problem would you be stuffed? Perhaps it would be an idea to have someone do the internet equivalent of checking its oil every year.

  • Check it works in browsers released since your site was created
  • Update any ready made systems your using, WordPress, plugins etc
  • Check you have backups of your files and or databases
  • Check it isn’t using deprecated functions

If this sounds self serving it genuinely isn’t most people will charge you a whole bunch for rebuilding an entire site that has got in a big mess. Compared to that small charges for simple maintenance are an economy.

Give your site some care.

Fuzzy testing

Been trying to work out what browser based testing is good for and not good for. Went to a talk to the other night at syncnorwich about testing at google scale. Seems they do use browser based testing but more as a top level of icing above a lot more tests of smaller units of functionality at code level.

It seems to make sense to test things as they are seen by the client, so I’ve been poking at Watir which allows for remote control of web browsers and therefore integration into automated tests. Apparently its jut one way of going about doing this and its a thin wrapper around selenium and web driver. I’m currently also interested in Ruby though so I went with watir (pronounced water apparently).

it seems browser based testing is good for a few use cases

  • Different browser
  • End to end tests
  • Random inputs
  • Pounding on a url with random urls

It seems like probably browser based testing is good for end to end overview testing. Making sure that even though all your unit tests work the web application works fine when all put together.

Daniel Wagner-Hall mentioned fuzzy testing to me which seems an interesting idea and something easy to automate but its not something I’d heard of before.
So I started on wikipedia

“Fuzz testing or fuzzing is a software testing technique, often automated or semi-automated, that involves providing invalid, unexpected, or random data to the inputs of a computer program. The program is then monitored for exceptions such as crashes, or failing built-in code assertions or for finding potential memory leaks. Fuzzing is commonly used to test for security problems in software or computer systems.”

This seems like something that watir would be good for pounding on a page/site with random form inputs testing out back and forward browser actions, clicking random links etc. Cat walks across the keyboard style. The kind of thing a monkey would be good at one of the monkeys that aren’t busy typing the complete work of shakespeare. Never really understood why would a monkey would want to type shakespeare surely monkey fiction would be quite interesting?.

So anyway I’ve given my monkey something more interesting to do. You will need to have Watir installed/setup and I’m using Firefox but you could swap that out for your browser of choice.

web monkey script

Mum Testing

Just been trying out a new site on my Mum’s friend.

Doesn’t need to be your Mum any other user is fine as long as they match the profile of the users you expect to see. I’m trying the site out on my mum and my mums friends because that is the age group we expect the site to be most used by. I’ve built sites before for school age kids and we tried it out on them and their teachers.

Part of it is just to get a new view, often you get so used to how something works ‘because you built it’ that you forget how other people use the interweb. Your friends often have similar levels of familiarity with the technology as you so use things in the way you would expect. Mums are quite good because they don’t use things how you do, just sitting behind someone using your site/application can teach you a lot. The technology they use may be different as well you might use a nearly new massively monitored Mac and they are using a venerable small screened PC. Or perhaps they are part of the majority of the population who use something other than an iphone. That can be quite revealing as well. Much of the benefit though is just the first view effect, they like perhaps the majority of the visitors to your site are seeing all this for the first time. If your tester can’t figure something out its probable a large group of your potential customers won’t be able to either.

Example

For example I watched someone fill in a form and miss out the email field, I thought I’d made it really clear the field missed changed colour to make it stand out as it did its label and its border. It even added a block of text at the top of the form explaining that the field had been missed. The tester didn’t notice any of that so I added in a movement when you clicked submit the page scrolled up to the missing field to draw you attention to it.

It also brought up another issue for me though as I found myself saying “don’t worry you won’t get any junk emails”. That led to adding a little note at the top of the page to clarify how the details you enter will be used.

Different folks

Different groups of users may have different levels of skills and familiarity with the subject. Something that may make a lot of sense for school teachers won’t may not make sense for others, but if your customers are school teachers then that is fine.

You need a few people though just to get a range even if the first couple of people show up the vast majority of the issues. Users do the craziest things which is explained quite well by Steve Krug in “Don’t Make Me Think!” its not consider page in depth its more a smash grab, super market sweep style. They almost certainly won’t use your site in the way you imagined.

A book that got mentioned by Tarek at my local Ruby user group when we were talking about human machine interaction and the assumptions that users bring is ‘The Design of Everyday Things’ by Donald Norman. I have not read it yet but it sounded like it could be useful.