turquoiseowl / i18n

Smart internationalization for ASP.NET
Other
556 stars 156 forks source link

Is there any option to change single quotes(') in french language ? #262

Closed codebuger closed 8 years ago

codebuger commented 8 years ago

In my application I have used html codes for designing web pages. While using french language, the generated po files having single quotes(') so this leads to alignment issue in webpage. Is there any option to change this in generated po file ?

Note: If I change single quotes(') to html code(&#39) in po file, it is working fine. But I don't want to do this manually.

turquoiseowl commented 8 years ago

I'm not clear on what you are asking. Is the French language special in this regard? What do you mean by alignment issues?

Are you saying that you are including &#39 in a nugget and the corresponding message being stored in the PO files is being HTML-decoded, but you want it left as it is?

codebuger commented 8 years ago

For example, I have included a button in jquery like this, $('<input class="btn" type="button" value="[[[Click]]]" title="" /> '); I am getting error in script that ')' is missing because the translated french text has single quotes(').

After translated PO file to french in google translator, I got po file which has translated text of french language. In this file I have replaced single quote(') by html code(&#39). And it is working fine.

What I am asking is, we cannot tell customer to manually change this single quotes. Is there any other option in i18n plugin ?

turquoiseowl commented 8 years ago

I am getting error in script that ')' is missing because the translated french text has single quotes(').

Sorry to be thick here, but I really don't understand what you mean or what is going on. Perhaps if you would be more precise about what is in source code, what is the corresponding message in the PO file (i.e. the actual entry for the message intems of msgid and msgstr) etc.. Thanks.

codebuger commented 8 years ago

Ok. Leave that line. I am getting below line in po file after translated to french. "Ajouter L'autorisation de l'utilisateur". I need to change this single quotes to &#39 programatically. It is possible in i18n ?

turquoiseowl commented 8 years ago

No, not at present. If you are using an automated translation facility, you might look at processing the output from that as appropriate before uploading it to your locale folder. (If there is an issue with i18n then I'm willing to look into that.)

codebuger commented 8 years ago

I have below doubts. Please clarify me

  1. I am using google translator to translate to french. So I cannot able to change this single quotes ?
  2. I think I can replace this single quotes to &#39 by using script. Is there any way in i18n plugin to identify if french language is selected ?
tomasr78 commented 8 years ago

I am also looking for option to escape apostrophe in translated strings. Apostrophe cause JS exception in minified java-scripts files because it is reserved symbol by default. Easy to reproduce:

  1. Add the text into Javascript file: [[[membership]]]
  2. Add translation text: [[[l'abonnement]]]
  3. Minify JS using MVC ScriptBundle.
  4. Run the web page and let i18n translate the text, the exception will be thrown in JS.
turquoiseowl commented 8 years ago

Have you tried l&apos;abonnement?

Is there any reason for not doing that?

turquoiseowl commented 8 years ago

Please re-open if still an issue. Thanks.

elviajero971 commented 2 years ago

@turquoiseowl hello there!

It seams that I'm having issues with apostrophe ' inside i18n translation file inside a Rails App ( ruby '2.7.4'and rails '6.0.3.3')

When I add a translation to a file content/fr.yml, for example: title: "contenu recommandé l'abi", it render the string correctly for the concerned content.html.erb file.

However when I add a similar translation to an another file booking/fr.yml, for example content: "l'heure de l'échange.", it doesn't render the translation properly for the concerned file booking.html.erb The only known difference to me, is that the second file booking.html.erb is rendered using javascript (specifically jQuery)

The render I have for this transaltion is: l&#39;heure de l&#39;échange

I've tried your syntaxe with &apos; and also title: 'contenu recommandé l''abi' but with no success until now.

It seems that I'm missing something here but I cannot figure out what is...

Any clues ?

elviajero971 commented 2 years ago

Update! I have finally found a solution using _html https://guides.rubyonrails.org/i18n.html#using-safe-html-translations