Re: Extensions: Why does String.format() work



Hi Eric,

I'm don't know much about (G)JS, but did you saw the underscore in
front of your example string? Maybe gettext does some magic here.

Greetings,
Christoph

Am Sonntag, den 21.08.2016, 11:26 +0200 schrieb elbenfreund:
Hello list,

while browsing some of the existing GNOME-Shell extensions source [1]
noticed string formating similiar to C or python:
``'some_random_string'.format()``.
I'm not really that familiar with JS but by all accounts ([2], [3],
[4])
javascript does not have build in string formating.
So my question is, is there some additional magic happening when JS
is
parsed for extensions? Why does this work? Did I miss something?

Thank you for your time
Eric.

[1]
https://git.gnome.org/browse/gnome-shell-extensions/tree/extensions/d
rive-menu/extension.js#n106
[2]
http://stackoverflow.com/questions/610406/javascript-equivalent-to-pr
intf-string-format
[3]
http://stackoverflow.com/questions/18405736/is-there-a-c-sharp-string
-format-equivalent-in-javascript
[4]
https://developer.mozilla.org/de/docs/Web/JavaScript/Guide/Text_forma
tting



_______________________________________________
gnome-shell-list mailing list
gnome-shell-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-shell-list
-- 
Visit me:
https://twitter.com/criztovyl
https://criztovyl.joinout.de
https://github.com/criztovyl

Attachment: signature.asc
Description: This is a digitally signed message part

Attachment: smime.p7s
Description: S/MIME cryptographic signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]