-
Notifications
You must be signed in to change notification settings - Fork 96
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
Potential Abuse of Reusable Quote (%q) in bluetooth/utils_notify.go #5
Comments
Thanks for the advice. So you mean we should use following string instead? format := Tr("Make sure '%q' is turned on and in range") It's really an importante rule for translation, I will report to my colleagues to let them known. |
%s. %q, as stated before, gives you a segment of string literal, and putting quotes around such literal sounds even worse.
Nobody wants that, right? (Also assuming the chinese "hello-world" is not being transformed into any |
So here is how old things like Basically, things are passed down to Gnulib: Quoting. The full implementation is here at http://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/quotearg.c#n1001. We only want the gettext-enabled
These steps show what are needed by GNU guys to make their things. Hmm, now I feel like you should just write something that chops off the quotes from |
Amazing skill! Looks I misunderstand you at first. You mean we should quote the argument string through a general function to make the localization right. Yes, it's a better style, I have post it to the upstream developer center, and welcome to discuss more things there :) BTW: looks the bluetooth module do not need a quoting operation for it should provide the original name of the device~ |
There has a g_shell_quote function we can use. |
Yes, and that's why I wrote down what it basically does here so you can just implement it yourself even without reading the code (and breaking some clean-room rules or whatever)… |
The std packages of golang has this https://golang.org/pkg/strconv/#Quote |
……The quote function is merely another However, as mentioned in that comment again, I think just removing the quotes from the string literal produced and plugging in the localized quotes is acceptable, i.e. |
See https://github.com/linuxdeepin/dde-daemon/blob/release/3.0/bluetooth/utils_notify.go.
%q
is not quite intended for use with UI text; actually 'a double-quoted string safely escaped with Go syntax' -- yes, a piece of reusable source code. For quoting normal people use a pair of curly single quotes‘...’
in general UI text (GNOME HIG, see also gettexten@boldquot
), and for localization one might leave two strings consisting only of these characters to be left out for translation like"‘"
and"’"
.CLI Dark Ages? People used ``...'
, and likewise they leave
"`"` and `"'"` out for translation.The text was updated successfully, but these errors were encountered: