I have an application with different languages.I have translated the word Logout ** in spanish language.The translation for **Logout in spanish is Cerrar sesión.But when it is translated it gives Cerrar sesi�n.please Help.How can i overcome from this. It gives � when any spanish word have some sign upon the letter.
this is encoding problem, check if all the files or resources are saved or served as UTF-8 and if utf-8 encoding is defined in the page
Define alerts you want in Several language like this,
alert_indiff_language = {
"english" : "Are you sure you want to delete?",
"Dutch" : "Sind Sie sicher, dass Sie löschen möchten?"
}
your_function() {
alert(alert_indiff_language[language])
}
Related
I am doing website translation to russian language and I dont know what is better, more used for URL namespace - cyrillic or latin, for example xyz.com/команда or xyz.com/komanda. I found when I was googling more sites in latin. Is it more used in Russia?
depends on server, usually browser converts not Latin url symbols to UTF-8 and sends, server may accept them or reject.
For example, all these 3 URL below are identical:
https://www.rabota.ru/vacancy/программист/
https://www.rabota.ru/vacancy/%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%81%D1%82/
Cyrillic symbols UTF-8 encoding:
%D0%BF - п
%D1%80 - р
%D0%BE - о
and so on
my app work with SMSC, and i need to get involve in sms before it send,
i try to send from the mobile that string
"hello this is test"
And when I check the smsc I got this as binary string of my text:
userData = "c8329bfd06d1d1e939283d07d1cb733a"
the encoding of this string is:
<Encoding:ASCII-8BIT>
I know that probably this userData is in GSM encoding in binary-string
so how can i get from userData back the clear text string ?
this question is for english lang, because in Hebrew I can get back the
string with this code:
[userData].pack('H*').force_encoding('utf-16be').encode('utf-8')
but in english i got error:
Encoding::InvalidByteSequenceError: "\xDA\xF3" followed by "u" on UTF-16BE
What I was try is to detect the binary string with ICU, and I got:
"ISO-8859-1" and the language that detected is: 'PT', that very strange cause my languages is English or Hebrew.
anyway i got lost with encoding stuff, so i try to encode to each name of list from Encoding.list
but without luck until now
thanks in advance
Shmulik
OK,
For who that also have this issue, i got the solution, thanks to someone from #ruby irc community (i missed his nickname)
The solution is:
for ascii chars that interpolate to binary:
You need that:
"c8329bfd06d1d1e939283d07d1cb733a".scan(/../).reverse_each.map { |h| h.to_i(16) }.pack('C*').unpack('B*')[0][2..-1].scan(/.{7}/).map.with_object("") { |x, s| s << x.to_i(2) }.reverse
Remember I sent this words in sms:
"hello this is test"
And that it has become in binary to:
"c8329bfd06d1d1e939283d07d1cb733a"
The reason that i got garbage in any encoding is, because the ascii chars is 7bits GSM, so only first 7bits represents the data but each another encoding uses at least 8bits, so that what the code actually do.
But this is just for ascii char set.
In another language like I use Hebrew, the SMS send as ucs2
So this code work for me:
[your_binary_string].pack('H*').force_encoding('utf-16be').encode('utf-8')
Very important to put the binary string in array
So that all for now.
If anybody want to translate and explain what exactly happen in the code for ascii char set, be my guest and welcome.
Shmulik
Taken from the rails guide:
You may use YAML (.yml) or plain Ruby (.rb) files for storing your translations in SimpleStore. YAML is the preferred option among Rails developers. However, it has one big disadvantage. YAML is very sensitive to whitespace and special characters, so the application may not load your dictionary properly.
Im trying to load my i18n locale files in a .rb files since the spanish accents in the .yml file end up throwing a I18n::InvalidLocaleData error.
However Ive tried copy pasting the file into a .rb and it doesnt work. How is this supposed to be done?
One option would be to do it like this:
{ de: {
errors: {
messages: {
restrict_dependent_destroy: {
one: "Datensatz kann nicht gelöscht werden, da ein abhängiger %{record}-Datensatz existiert.",
many: "Datensatz kann nicht gelöscht werden, da abhängige %{record} existieren." }}}}}
Where %{record} would be interpolated.
I need translate this sentence:
My name is "Josep", whar's your name?
In the po file, this sentence would be:
msgid "My name is "Josep", whar's your name?"
msgstr "El meu nom es "josep" Quin es el teu"
But this throw a error when I make the .mo file due to quotes inside josep name.
How can I scape this character?
I think you need to escape your " as \".
I was wondering if there is something for blackberry to escape html values, basically I want to show just plain text that's coming from and rss. However the rss is returning values likes this:
<item><guid isPermaLink="true"><![CDATA[http://www4.elcomercio.com/deportes
/Vettel_F1_China.aspx]]>
</guid>
<title><![CDATA[ Vettel domina primer día de ensayos en China]]></title>
<description><![CDATA[El alemán Sebastian Vettel, de Red Bull, realizó el mejor tiempo en la segunda sesión de entrenamientos libres del Gran Premio de China de Fórmula 1, el viernes en el circuito de Shanghai, tercera prueba del campeonato, tras haber dominado el primer ensayo.<br />
<br />
I can sucesffuly retrieve the title and description tags content, but now I would like to remove all the CDATA, <br /> or any possible html tags that I could find.
I tried using JSoup however it uses JVM 1.5+ classes like Enum, and as result I couldn't preverify the jar to use it on Blackberry-JavaME. Also I haven't found any class in the RIM API that could help on this task, maybe I missed a class or a library that I could use. This is just to avoid writing code that's probably already done on several libraries.
Thanks a lot.
Have you tried using SAX Parser and just getting the values for the characters(...) method for each endElement ?
Here is a brief tutorial on SAX Parser for Blackberry:
http://jsinghfoss.wordpress.com/2009/09/06/sax-parsing-revising/
Well, couldn't find a prerolled class, however there is a library that allows us to use regex in Blackberry projects, it's called regexp-me. Helped me to remove the tags in an easy way. SAX Parser is also a solution, but if you want something more simple like in this case, I think regexp-me is the best option.
Thanks.