Making a translator in coda: any tips?

I was trying to make a translator in coda (without google translate), But it only translates one character at a time.

Take a look at the translating page below.

Type “a cat” it is supposed to “ein katze” but instead, it translates to “a katze”.

Click Here to view the doc.

Hey @BODHI_SCHNEIDER the permissions don’t allow me to see the formula.

Try the embed version, and double click on the “translate” button.

Hey @BODHI_SCHNEIDER, you may have already but considered this, but did you try our in-doc translate template? If you just type ‘/translate’ you’ll see the Template option appear.


True, but I’m on the free account in google translate is a pro account pack. Not a bad idea though.

I could try making a column just for “a cat” but if that was the case, there would be to many sentences to type (and it would go over the doc size limit).

Hi, @Johg_Ananda, try clicking the link now, I changed the mode from Play to Edit.

OK @BODHI_SCHNEIDER I think I figured out what is happening. When you press Translate Button it pushes all the buttons in Word simultaneously which loads into memory the current state of the tables. Then Coda processes each sequentially through their rank in the table. So the first button, which holds a runs Replace() and it changes the ‘a’ to ‘ein’ so Translation result here. becomes ‘ein cat’ and then b runs, etc until cat runs which then takes the original value loaded which is ‘a cat’ and then replaces ‘cat’ with ‘katze’ which becomes ‘a katze’. As it is the last button to run its value remains.

Before I provide a solution, I thought you might have more fun to solve it with this new info. Good luck and let me know if you need more help.


Cool, so if Grammarly used Coda, Grammarly would use the Replace() formula!

One question though @Johg_Ananda, does this mean in the ‘word’ table there has to be a column that looks like this:

letter user typed = A cat; Changed to German = Ein katze;

Because if that was it, how many words in German are there?

It really depends on how you want to deal with the problem. I don’t think a one for one substitution is going to produce good translations for speaking … so I don’t know what exactly you’re trying to do. Your approach is going to depend on that.

1 Like

Well, I might need some help were I am now, when I press the “translate” button and when I made the changes, It didn’t want to translate anything.
So when I type 'A cat" it translates to ‘A cat’ . Anything you have seen before?

What are you trying to accomplish? replace each word for word?

Yep. For a character translation, ‘A’ translates to ‘Ein’.

I think you could accomplish this by using Split() to break up the sentence, then using FormulaMap() to iterate through each word and then Replace(). Hope that gets you in the right direction :slight_smile:

I’m definitely having fun trying to figure out how to put the formula together :smile:!

One question about the replace(), @Johg_Ananda: It requires a ‘start’ and ‘numberOFCharacters’ How do I get those numbers?

Hi I created a new page in you Doc that shows how I would approach your problem. I hope it makes sense to you.

:clap: :clap: LOVE IT!

1 Like

FormulaMap(), WithName(), RegexReplace() and RegexMatch() are really powerful. Everyone should learn how to use them.