-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Praise in other languages #33
Comments
I can help for praise in French 😄 |
@masalmon Cool, I'll soon update the code to handle multiple languages. |
Merveilleux ! Fantastique ! Superbe ! |
I am thinking about a good way to do this. The goal would be to be able to write praise(gettext("Your tests are ${adjective}!")) or something like this, and then get praise in multiple languages. Two things are required for this:
E.g. the Does this make sense? Or do we want to try automatic translation via the google translate API? I guess that could be error prone, so maybe the NLS way is better? |
Would it be a lot of work to test the google translate API on a few examples to see how bad the results are? |
The thing is, even is we can use google translate, we also want a way that lets people have more control. So why not start with that? |
Hi @gaborcsardi following up on this -- a bit late sorry. What exactly could I do to help make @chucheria would like to contribute for Spanish. |
@masalmon Thanks! I guess we would need to decide what "work" means. I.e. consider praise::praise("Your tests are ${adjective}!")
praise::praise("${EXCLAMATION} - ${adjective} code.") So how would (hypothetical) user Hadley add support for other languages? Or all this would be automatic? The two obvious solutions are:
The first solution is nice if it works well, and maybe it works well for simple templates. Maybe we can implement both solutions. What do you think? |
I guess the first solution is easier? Or in the case of a package like Also, the idea would be to have people contribute the nice adjectives (because then you only need to know your language and a few git commands), but I guess that part is easy. |
Anyway, maybe we can implement both? Let's implement the automatic way, and see how it works. Btw. Google translate is not free any more, but maybe this works: http://www.r-pkg.org/pkg/RYandexTranslate
Agreed. |
I've just installed I've also looked at your commit regarding language detection, is there a particular reason you use |
Last very small things for today, I looked at The Yandex API works well for the unique sentence to be translated in > translate(api_key, text = "Your tests are", lang = "en-fr")
$lang
[1] "en-fr"
$text
[1] "Vos tests sont" |
I've just realized that in languages like French |
DOn't remember. Looks like this is what I am doing: 0ca9979#diff-951791f1fb37d9e5b0f0cf852ce38d83R30 I suppose we can add
Maybe, but in general I would leave writing sentences up to package authors depending on praise.
Hmmm, yeah, that's a problem, and more "complicated" languages will be even worse. So I would keep it simple and use the auto-translation for suggestions only. Maybe the manual praise translation is even better, then people speaking various languages can just contribute translations to |
> Sys.getlocale()
[1] "LC_COLLATE=Spanish_Spain.1252;LC_CTYPE=Spanish_Spain.1252;LC_MONETARY=Spanish_Spain.1252;LC_NUMERIC=C;LC_TIME=Spanish_Spain.1252"
> Sys.getlocale("LC_COLLATE")
[1] "Spanish_Spain.1252" so the
|
OK, we'll need to read more about locales I suppose. Or find good code that gives a two or three letter code from the locales.
Package author writes the sentences in all languages she knows. (She can get help from auto-translation, but I would implement auto-translation later.) Then people that know other languages can submit pull requests that add support for other languages that praise supports. I think this is good, because it encourages collaboration. |
|
Sure, that makes a lot of sense. We can have a |
What would the |
Oh, no, sorry, these would be just praising sentences that are kept within |
There's a R package for plurals but only in English, what a pity: https://github.com/hrbrmstr/pluralize |
@masalmon No prob, if we go the "manual" way, we don't really need that. Btw. I think |
Just a summary of the discussion (cc @chucheria ) @gaborcsardi please correct me if I'm wrong which I quite likely am :-)
|
I would not put locale stuff in praise_lang("You are ${adjective}!", lang = "en")
praise_lang("Du bist ${adjective}!", lang = "de") or sg like this. |
Or even just
or
|
Another way would be to use gettext... |
What is gettext? |
The standard way to translate text messages. See |
So with gettext, people could just write praise("You are ${adjective}!") as before, but then
Then the messages would need to be translated using e.g. |
This sounds like the easiest solution? |
For the users, yes. Even for people adding new words. For people dealing with the translation system (=us), not really. :) |
But then we can praise ourselves ;-) |
OK, I implemented a framework: https://github.com/rladies/praise/tree/international I'll write a short guide on how to add translations, and then we can test it on you if you don't mind. :) Btw. we'll need to re-organize the package a bit, because non-ASCII characters are not allowed in code. So I'll move the words to |
Awesome! Looking forward to testing it. Génial ! J'ai hâte de le tester ! |
Here is a short how-to: https://github.com/rladies/praise/blob/international/inst/international.md I have added Hungarian, not too many words, just s PoC. FYI. |
I'll have a better look next week but this looks AWESOME! 👏👏👏 |
For other languages it's important to make the difference for genre, its not the same expressions for men than for women, can change the written and also the meaning from very good to very bad ^_^ |
Specifically Chinese first, via @Avatoo. \o/
We need to work out some simple architecture first.
The text was updated successfully, but these errors were encountered: