
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@contember/admin
Advanced tools
@contember/admin
component?First, write a dictionary of messages that need to be translated:
export const myDictionary = {
myComponent: {
key1: '…',
key2: {
nestedKey: '…',
// …
},
},
}
export type MyDictionary = typeof myDictionary
Note the top-level myComponent
property under which all is scoped.
That is crucial so that we can easily compose dictionaries. Include one just like it and make its name unique.
You can nest objects and strings arbitrarily. The structure, however, will be public API so try to make it future-proof.
In your messages, you can make use of whatever syntax intl-messageformat
supports.
From your index.ts
file, don't export the dictionary! Use export type
to only expose its type:
export type { MyDictionary } from './myDictionary'
Then from your component, obtain a message formatter:
const formatMessage = useMessageFormatter(myDictionary)
That gives you a function that returns translations. There are two main ways of using it:
formatMessage('myComponent.key2.nestedKey')
or formatMessage('myComponent.key1', { variable: 123 })
.formatMessage(userSpecified, 'myComponent.key2.nestedKey')
or formatMessage(userSpecified, 'myComponent.key1', { variable: 123 })
.In both cases, the final parameter with variables is optional. In this case, the type of formatMessage
is MessageFormatter<MyDictionary>
. You can use this to pass it down as a prop.
⚠️ Lastly, add your newly created dictionary to adminDictionary.ts
. After you do that, you will likely
get TypeScript errors in @contember/admin-i18n
. Add any translations there as well.
For more inspiration, look up any existing dictionaries mentioned in adminDictionary.ts
and the way they are used.
FAQs
Unknown package
The npm package @contember/admin receives a total of 237 weekly downloads. As such, @contember/admin popularity was classified as not popular.
We found that @contember/admin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.