5

So I've got to work with this set of code here for a re-write, and it's written by people who speak both English and French.

Here's a snapshot of what I'm talking about (only, about 4000 lines of this)

function refreshDest(FormEnCours,dest,hotel,duration) {
    var GateEnCours;
    GateEnCours = FormEnCours.gateway_dep.options[FormEnCours.gateway_dep.selectedIndex].value;
    if (GateEnCours == "") {  
        FormEnCours.dest_dep.length = 0  
    } else if (FormEnCours.dest_dep != null && FormEnCours.dest_dep.type && FormEnCours.dest_dep.value != "ALL") {
      if (Destinations[GateEnCours] == null || Destinations[GateEnCours].length == 0) { 
          RetreiveDestinations(FormEnCours,GateEnCours,dest,hotel,duration);
      } else { refreshDestSuite(FormEnCours,GateEnCours,dest,hotel,duration); }
    }
}

function refreshDuration(FormEnCours,GateEnCours,DestEnCours,hotel,duration) {
    // Refresh durations
    var FlagMoinsDe5Jours = "";
    var Flag5a10jours = "";
    var Flag11a16jours = "";
    var FlagPlusDe16Jours = "";
....... 

Is there any approach that I, as a speaker of only one of these languages, can use to make this entire process a lot less painful for both figuring out what everything does, and then refactoring it?

FrustratedWithFormsDesigner
  • 46,105
  • 7
  • 126
  • 176
Incognito
  • 3,458
  • 2
  • 25
  • 38

4 Answers4

6

This isn't going to be that helpful, but I only see two options.

  1. Learn French
  2. Refactor

I am strongly in favor of the second option. It prevents someone from having to deal with the same issue in the future. It also increases the consistency throughout the code base to a certain style of coding (which seems to be lacking in general as there are variables that start with both upper and lower case letters).

4000 lines is not too bad to have to fix. I think the bigger issue is to get the team that works on the code base to follow a defined style of coding.

unholysampler
  • 7,813
  • 1
  • 30
  • 38
  • But this fix better be made at the right time, or else the product will suddenly break. – Job Mar 16 '11 at 20:11
2

about 4000 lines of this

You can probably fix this in a 2 hours with Goggle translate + Search and replace.

Once done, Get your self a beer and add it to your "Black Book of War stories" with proper embellishments.

Morons
  • 14,674
  • 4
  • 37
  • 73
1

I had a similar issue once with a classic ASP site, only it was a mix of English and Spanish. I became good friends with Google Translate. I also changed names to English when I could as my English speaking team had taken over the project.

Is there anyone on your team that speaks French? Could they help with some translations?

Tyanna
  • 9,528
  • 1
  • 34
  • 54
1

If you ever need to send code back to that team, be sure to change the names to Russian. And if your compiler allows it, use Cyrillic characters.

Dima
  • 11,822
  • 3
  • 46
  • 49