-3

Is it okay, if you give HTML fragments to translators? If not, what do you give them and how do you get the HTML fragments back?

So is this okay to hand down? Hey <i>Bob</i>, what's your <span class="important">name</span>?

duality_
  • 17,738
  • 23
  • 77
  • 95
  • 2
    are you using any server side software to generate this html? if so you would typically just give the translators your resource file, which is used to store all display text. – Antony Scott Feb 16 '12 at 16:31
  • Yes, I do use it. So, I don't understand, is my example okay? – duality_ Feb 16 '12 at 16:45
  • 2
    related question: http://stackoverflow.com/questions/273847/how-do-you-handle-translation-of-text-with-markup (possibly a duplicate) – Antony Scott Feb 16 '12 at 17:25

3 Answers3

4

You give the translators whatever you agree with them (i.e. ask the translators what they need, not other programmers).

Throwing the markup away and giving them word fragments without context is likely to cause translation errors though. Context is important for meaning.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • I do give them context. And you still haven't answered my question ;) - "what is usually given to translators?"... – duality_ Feb 16 '12 at 16:44
  • 2
    We've given translators strings with embedded Ruby ("Successfully imported #{count} records.") that wouldn't have made sense without including the interpolated variable. You just need to make sure they're technical enough not to screw up your syntax. – Brandan Feb 16 '12 at 16:46
  • @duality_ — You asked what you should give them, not what is usually given to them. "Usually" isn't a good guide. Find out what *your* translators are comfortable dealing with. – Quentin Feb 16 '12 at 16:58
  • Well, either way, I'm still waiting for an answer. – duality_ Feb 16 '12 at 17:02
  • @Brandan: Thanks, glad to see that others are doing it too :). Maybe you can change that to an answer so I can vote it up. – duality_ Feb 16 '12 at 17:03
  • @Brandan +1 for "technical". It does depend on how technical the translators are. I prefer to make thing unambiguous. I'm not sure I'd ever give them the html. We have resource system where I work, we've got everything in a database which is exported to resource files. So, all we have to do is give the translators the url to the page we're written which allows them to do the translation. – Antony Scott Feb 16 '12 at 17:14
  • So, two different real life examples, two different approaches, both agreeing that it depends on the translators. Which brings us back to "ask the translators" :) – Quentin Feb 16 '12 at 17:16
1

To elaborate on my comment on Quentin's answer:

We're using Ruby on Rails for our UI, but we ship an appliance. There's no URL we can send our translators for context. We'd have to send them an entire ISO, and even then they wouldn't be able to actually use the application without proper data.

Instead, we send them the raw Yaml files from config/locales, where there's one resource file per target language: en-US.yml, fr.yml, de.yml, etc. They import these files into whatever system they use, translate, export, and send us the translated Yaml. If they need context, we send them screen shots.

So anything that Rails accepts as a translatable string, we send it directly to our translators. We even extended Rails's capabilities to accept ERb templates within strings. That was a very bad idea :-)

I'm not saying this is the best solution. We often get back invalid Yaml, or they miss strings or don't translate as accurately as they could with perfect context. But it works in general.

Brandan
  • 14,735
  • 3
  • 56
  • 71
0

If you're using some software to generate the html (ie - php/asp/asp/net/etc) then don't give the translators the resultant html, give them the resource file you used to generate the html.

You will then have a resource file for each language you want to support. You can then use either browser language settings (accessible via headers server side), the request url or even a cookie (after you asked them what language they prefer - see quietpc.com for an example of that) to figure out which language the user wants to see you site in.

Now you know what language to present your site it, you can then write you server side code to read the relevant resource file and you're all set!

So, instead of this ...

Hey <i>Bob</i>, what's your <span class="important">name</span>?

... you would have this ...

<%=Resources.Hey%> <i><%=Name%>, <%=Resources.Whatsyour%> <span class="important"><%=Resources.Name%></span>

But, splitting things up like this is very bad IMO. It is better to reword things so they're not split up. I don't think this is a great example as you're asking Bob what his name is. It's Bob!!

I always try to lay out my pages so that I don't intermix variables with text.

Example ...

Name: Bob
Mood: Happy

Name and Mood can be translated. Bob and Happy are coming from variable somewhere, ie - they're dynamic.

Example markup ...

<table>
    <tr>
        <td><%=Resources.Name%></td>
        <td><%=Name%></td>
    </tr>
    <tr>
        <td><%=Resources.Mood%></td>
        <td><%=Mood%></td>
    </tr>
</table>

This is just how I've approached it in the past as I don't speak any other languages other than (bad) english, I don't really know if the way sentences are structured changes based on context. So, I've always tried to avoid sentences with embedded variables in them.

Antony Scott
  • 21,690
  • 12
  • 62
  • 94
  • So if this is bad, how *would* you do it? – duality_ Feb 16 '12 at 17:06
  • I wouldn't ask Bob what his name is!! Seriously I tend to use little tables with information in them. So I can have a label which I can translate then the text is to the right/below that label. – Antony Scott Feb 16 '12 at 17:07
  • I thought it was obvious that this is *not* real life code, but just an example. I hope the following is better for you :) Hey Bob, how you doin'? However, I don't understand your technique, so do you split an HTML fragment like this? Can you elaborate in your answer? – duality_ Feb 16 '12 at 17:16
  • I've added a bit more explanation to my answer. – Antony Scott Feb 16 '12 at 17:23