![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@wealthbar/i18n
Advanced tools
These tools have been designed specifically for the WealthBar team to translate VueJS apps using gettext and the Transifex service. If you feel they are useful to you or your project feel free to use them.
You must explictly add i18n directives and functions using a mixin. This is done globally by adding;
import { i18nMixin } from '@wealthbar/i18n'
Vue.mixin(i18nMixin)
But it can also be loaded locally in any directive if global behaviour is not desired.
In Vue component templates you can use the v-translate
or v-t
directive.
<p v-translate>Translate this content.</p>
<p v-t="['this', 'message']">Translate %1 %2</p>
<p v-t context="imperative">Translate</p>
You can supply arguments to replace ordered labels in the string to the
directive as a binding value. Adding a context
attribute will set a context
for a particular string so that it can be translated multiple ways depending on
the context of usage.
It is also important to escape reserved HTML entities like <, > and & as <
,
>
and &
to avoid a mismatch when translating.
<span v-t>5 > 3 & 6 < 7</span>
It is ok to include HTML elements in translated strings, but they must not include VueJS components, directives or bindings. Otherwise the translated content will change and the translation will not longer match.
<p v-t>
<span>This is a description of</span>
<a href="https://somewhere.example">a link</a>
<span>to some content.</span>
</p>
In Vue component code use the this.$t
to translate strings in code within Vue components.
computed: {
message() { this.$t('translate this message'); }
}
It is possible to substitute arguments by supplying them as a second argument.
computed: {
message() { this.$t('translate %1 %2', ['this', 'message']); }
}
Finally you can supply a context as the third argument.
computed: {
message() { this.$t('translate %1 %2', ['this', 'message'], 'imperative'); }
}
Anywhere else it is possible to just import the translate function from the package.
import { translate as $t } from '@wealthbar/i18n`;
It is important to name the function $t
if you want to use the i18nextract
script to automtically find and extract translatable strings.
yarn i18nextract src/
This will scan .vue and .js files and extract strings for translation to i18n/messages.pot
https://docs.transifex.com/client/installing-the-client
After installing you will want to initialize using tx init
which will require
you to provide an API key for your transifex account.
tx push --source
These can be submitted to a translation service via the Transifex UI.
tx pull -f
Finally check in the translations and deploy.
FAQs
WealthBar's i18n toolkit
The npm package @wealthbar/i18n receives a total of 16 weekly downloads. As such, @wealthbar/i18n popularity was classified as not popular.
We found that @wealthbar/i18n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.