
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
This is a Python implementation of the Unicode Message Format 2.0 specification.
Message Format 2.0 (MF2) is a new iteration of Message Format which aims to be more expressive and flexible than both Message Format 1.0 and, in the context of Python, gettext.
If you would like to learn more about MF2 itself head over to the Unicode technical specification.
The library includes:
Via pip for Python >= 3.12
pip install messageformat2
from messageformat2 import format_message
format_message("Hello, {$name}!", {"name": "Alice"}) # -> "Hello, Alice!"
Messages can be reused with different inputs.
from messageformat2 import Message
message = Message("Hello, {$name}!")
message.format({"name": "Alice"}) # -> "Hello, Alice!"
message.format({"name": "Bob"}) # -> "Hello, Bob!"
There are several builtin locale-aware formatters available.
from datetime import datetime
from messageformat2 import Message
message = Message("Today's date is {$now :date}")
now = datetime.now()
message.format({"now": now}, locale='en_US')
# -> Today's date is 5/10/2024
message.format({"now": now}, locale='en_GB')
# -> Today's date is 10/05/2024
MF2 supports pluralization using built-in or custom selectors.
from messageformat2 import Message
msg = Message ("""\
.match {$count :number}
one {{You have {$count} notification.}}
* {{You have {$count} notifications.}}
""")
msg.format({"count": 42}, locale='en_US') # -> "You have 42 notifications."
msg.format({"count": 1}, locale='en_US') # -> "You have 1 notification."
Complete documentation is available here.
FAQs
Python implementation of Unicode MessageFormat 2.0
We found that messageformat2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.