Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
babelfish-plus
Advanced tools
Babelfish react helpers. Can be used for rendering props as react widgets. All babelfish power accessible from helper. Returns array of translated strings and functions:
t(message: string, params: ?Map<string, string|object|func>): Array<string|object|func>|string
t('Translated') // 'Translated'
t('Translated #{str}', {str: 'test'}) // 'Translated test'
t('Translated #{str} #{func} #{obj} #{arr}', {
t: 'test',
func: p => p,
obj: {a: 1},
arr: [1, 2, 3]
}) // ['Translated test', func, {a: 1}, [1, 2, 3]]
import translator from 'babelfish-plus'
const options = {
locale: 'ru',
phrases: {
user: {
birthday: 'День рождения: #{date}'
}
}
}
const t = translator(options)
t('user.birthday', {date: '01.01.1970'}) // 'День рождения: 01.01.1970'
t('user.birthday', {date: p => new Date(p)}) // ['День рождения: ', Func]
t('not.existing.path') // 'not.existing.path'
import React, {PropTypes} from 'react'
import translator from 'babelfish-plus'
import T from 'babelfish-plus/react/T'
const {func, string} = PropTypes
class Date extends React.Component {
static propTypes = {
date: string.isRequired
}
render() {
return (
<span className="date">{this.props.date}</span>
)
}
}
class UserBirthday extends React.Component {
static propTypes = {
date: string.isRequired
}
render() {
return (
<div>
<T>User info</T>
<T date={<Date value={this.props.date} />}>user.birthday</T>
</div>
)
}
}
class App extends React.Component {
static propTypes = {
t: func.isRequired,
birthday: string.isRequired
}
static childContextTypes = {
t: func
}
getChildContext() {
return {
t: this.props.t
}
}
render() {
return (
<UserBirthday date={this.props.birthday} />
)
}
}
const options = {
locale: 'ru',
phrases: {
'User info': 'О пользователе',
user: {
birthday: 'День рождения: #{date}'
}
}
}
const t = translator(options)
React.render(<App t={t} birthday="01.01.1970" />, document.geteElementById('root'))
FAQs
Babelfish based i10n
The npm package babelfish-plus receives a total of 9 weekly downloads. As such, babelfish-plus popularity was classified as not popular.
We found that babelfish-plus demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.