Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
@nextcloud/l10n
Advanced tools
Nextcloud L10n helpers for apps and libraries.
npm i -S @nextcloud/l10n
You can use helpers in this package in order generate code that also works when it's not loaded on a Nextcloud page. This is primary useful for testing. The logic will just return the original string if the global variable OC
isn't found.
In order to not break the l10n string extraction scripts, make sure to alias the imported function to match the legacy syntax:
import { t, n } from '@nextcloud/l10n'
// Or
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
t('myapp', 'Hello!')
n('myapp', '%n cloud', '%n clouds', 100)
See the localization docs for more info.
You can use this package to translate your app or library independent of Nextcloud. For that you need .po(t) files. These can be extracted with gettext-extractor.
import { getGettextBuilder } from '@nextcloud/l10n/gettext'
const lang = 'sv'
const po = ... // Use https://github.com/smhg/gettext-parser to read and convert your .po(t) file
const gt = getGettextBuilder()
.detectLocale()
.addTranslation('sv', po)
.build()
gt.gettext('my source string')
gt.gettext('this is a {placeholder}. and this is {key2}', {
placeholder: 'test',
key2: 'also a test',
})
See the developer docs for general guidelines.
gt.ngettext('%n Mississippi', '%n Mississippi', 3)
3.1.0 - 2024-05-07
escape
option per parameter replacing.// Example
t(
'my-app',
'{a}{userInput}{a_end}',
{
a: {
value: '<a>',
escape: false,
},
userInput: somePossiblyInsecureValue, // This will be escaped
a_end: {
value: '</a>',
escape: false,
}
},
)
FAQs
Nextcloud L10n helpers for apps and libraries
The npm package @nextcloud/l10n receives a total of 8,560 weekly downloads. As such, @nextcloud/l10n popularity was classified as popular.
We found that @nextcloud/l10n demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 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.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.