Few Documentation Clarification Requested -- Languages

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
GreenJelly's picture

I really dont know the answer to this, and I notice its not in the Language Documentation.

http://drupal.org/node/11130
http://drupal.org/node/31714

Neither one talks about if HTML is allowed or converted. It would be nice if this was mentioned. Even if its a Comment, that would be great. Can the Translations group please answer if you need to put HTML within the translations .po file, and/or the Admin interface... and then can we make changes/Comments to the appropriate documentation. There is a few places in both documents this information should/could go... anyone have suggestions...

Comments

test case?

hal2's picture

Are there any example po files that you can get the answer to your question from?
Why not test it and see what happens.. if you are delving into the code let your tests guide you.
I myself am a newbie too.

I would say that you would

hal2's picture

I would say that you would not include any html formatting, as that is part of the design, whereas you are editing a file that is not part of the design, more of the information side of things. In other cms's like joomla and e107 they never embedded html code in the translation file, only strings of text.
Hard coding html into the po file makes for a much more difficult and troubled cms to work, but don't take my word for it.

their forum

hal2's picture

http://drupal.org/forum/30
For the translation group forum

Yes, you can use HTML in the po-files

zirvap's picture

From what I've seen, it's mainly used for emphasis (< em > and < strong >) and for links (< a href >). Some examples from the core po-files for Drupal 6:

Users with the <em>administer nodes</em> permission will be able to override these options.

<strong>Warning:</strong> there is currently 1 %type post on your site. It may not be able to be displayed or edited correctly, once you have removed this content type.

The administrative <a href=\"@content\">content page</a> allows you to review and manage your site content.

I've also seen, a few places, headers and < p >:
<h1 class=\"title\">Welcome to your new Drupal website!</h1><p>Please follow these steps to set up and start using your website:</p>

There's an issue about creating documentation for How to write Drupal translatable interfaces.

--
Hilde Austlid, Drupalchick

..

hal2's picture

Big whoops there then! Sorry for any misleading info.

Question: What do people think about adding html to po files?

Answer: The only thing I can think of is that those po files are changeable, and therefore, with each different language, you get a different look.

Arguament: Now i know that english isn't perfect, but, don't users want to have full control over their strings with css files?

Minor transgression: Do css attributes get overwritten for strings that get given hardcoded ones?

...

zirvap's picture

Well, when you need HTML inside a sentence, it's much easier to translate it with the HTML there. There's an example here, where a string was split up into two fragments in order to avoid a <a href= inside the string. But this fragmentation made the string harder to translate.

For the last example I found, with <h1> and <p> inside the string, I suppose the HTML might as well have been placed outside.

Minor transgression: Do css attributes get overwritten for strings that get given hardcoded ones?

I'm not sure I understand your question. Do you mean, what happens if I translate <h1 class=\"title\">Welcome to your new Drupal website!</h1> as <h1 class=\"some_other_class\">Velkommen til det nye Drupalnettstedet ditt!</h1>? I assume that the new class is used, and that nothing remains of the class from the original string.

--
Hilde Austlid, Drupalchick

I meant hardcoding the

hal2's picture

I meant hardcoding the color, size and what else into the attribute, for those that don't use classes.

Can I offer a suggestion for the developers to come to a decision on whether a string can have an alternate piece of code attached to it?
I don't how to do this, as it becomes quite difficult when you have:

Hello

World string.
Or place an italic of one word inside a string.

As I said, some people are

zirvap's picture

As I said, some people are working on a guide on writing translatable interfaces. You can also take a look at Gabor's cheat sheet.

If you have a specific question about how to code strings in a module you're working on, I suggest you describe your question as clearly and concretely as possible. (Odds are I won't be able to answer, but you probably have better chances of getting an answer from the people who do know if your question is clear and specific).

Your examples (h1, strong and em inside strings) are covered by the examples I gave.

...or are you asking from a translator's point of view, asking what you can put inside your own translations?
If you're creating a translation just for yourself, you can do anything you want (although if you're planning to be really creative it might be a good idea to use a test site, in case your translation breaks something).
If you are part of a translation team, making a translation for common use, you'll have to get to an agreement with the other translators. In that case, I suppose you'd want to follow the formatting in the English text as far as practical, although there might be reasons to do things differently in some languages, for all I know.

--
Hilde Austlid, Drupalchick

I was bringing forward a

hal2's picture

I was bringing forward a question that may arise in the future about how code and strings actually come together, but I think it got lost in translation.. no worries.

Translations

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: