It'd be cool to attach metadata to string literals that doesn't end up
in the resulting string object. This metadata could be used by all sorts
of tools, everything from localization to refactoring.
In C, some localization libraries use macros for it, such as:
#define LOCALIZE(s) s
and it acts like an annotation, and then you do:
printf("%s", get_localized(locale, LOCALIZE("This string gets extracted
and used in language files")));
And I think Python could do better and have special string literals
explicitly for this purpose.
It could even be something with fstrings, like: f"{#localize}This string
gets extracted and used in language files"
Ofc, there's nothing preventing one from using something like f"{(lambda
_:'')('localize')}This string gets extracted and used in language files"
today, but I feel like having some sort of dedicated syntax for it would
be an improvement.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/OUUKHT7BBBNJC5TXATGCAPJQQCYSUHN3/
Code of Conduct: http://python.org/psf/codeofconduct/