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.
@transifex/vue2
Advanced tools
Vue2 component for localizing Vue application using Transifex Native.
Related packages:
If you are upgrading from the 1.x.x
version, please read this migration guide, as there are breaking changes in place.
Install the library and its dependencies using:
npm install @transifex/native @transifex/vue2 --save
import Vue from 'vue';
import App from './App.vue';
import { tx } from '@transifex/native';
import { TransifexVue } from '@transifex/vue2';
tx.init({
token: '<token>',
});
Vue.use(TransifexVue);
new Vue({
render: (h) => h(App),
}).$mount('#app');
T
Component<template>
<div>
<T _str="Hello world" />
<T _str="Hello {username}" :username="user" />
</div>
</template>
<script>
export default {
name: 'App',
data() {
return {
user: 'John'
};
},
}
</script>
Available optional props:
Prop | Type | Description |
---|---|---|
_context | String | String context, affects key generation |
_key | String | Custom string key |
_comment | String | Developer comment |
_charlimit | Number | Character limit instruction for translators |
_tags | String | Comma separated list of tags |
UT
Component<template>
<div>
<UT _str="Hello <b>{username}</b>" :username="user" />
<p>
<UT _str="Hello <b>{username}</b>" :username="user" _inline="true" />
</p>
</div>
</template>
<script>
export default {
name: 'App',
data() {
return {
user: 'John'
};
},
}
</script>
UT
has the same behaviour as T
, but renders source string as HTML inside a
div
tag.
Available optional props: All the options of T
plus:
Prop | Type | Description |
---|---|---|
_inline | Boolean | Wrap translation in span |
$t
template function or this.t
alias for scriptsMakes the current component re-render when a language change is detected and returns a t-function you can use to translate strings programmatically.
You will most likely prefer to use the T
or UT
components over this, unless
for some reason you want to have the translation output in a variable for
manipulation.
<template>
<div>
{{$t('Hello world').toLowerCase()}}
{{hellofromscript}}
</div>
</template>
<script>
export default {
name: 'App',
computed: {
hellofromscript: function() { return this.t('Hello world').toLowerCase() },
},
}
</script>
LanguagePicker
componentRenders a <select>
tag that displays supported languages and switches the
application's selected language on change.
<template>
<div>
<T _str="This is a translatable message" />
<LanguagePicker />
</div>
</template>
<script>
import { LanguagePicker } from '@transifex/vue2';
export default {
name: 'App',
components: {
LanguagePicker,
}
}
</script>
Accepts properties:
className
: The CSS class that will be applied to the <select>
tag.Licensed under Apache License 2.0, see LICENSE file.
FAQs
Vue i18n framework using Transifex Native
The npm package @transifex/vue2 receives a total of 116 weekly downloads. As such, @transifex/vue2 popularity was classified as not popular.
We found that @transifex/vue2 demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
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.