question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

component based translations

See original GitHub issue

Hej, I was wondering if somebody like component based translations would be possible. What i mean by this is that each component/page would add its own translation, this would keep the separation much cleaner. So each component would do

import english from './en.json'`

and in the component/page

created: function() {
  this.$i18n.add('en', english)
}

I quickly tried this out now, but it seems when you add with the same key, they don’t get merged but overwritten.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tikiatuacommented, Aug 31, 2017

There is a new release v1.7.0 that should enable the functionality you requested. We ended up modifying the add method to extend the translations and adding a new method replace, that will replace all existing locale translations (just like add did before).

Please try it out and let me know if it works for you.

0reactions
geertolaertscommented, Aug 31, 2017

yeah, This is fine for my current needs. Would be worse if i would use rest or something to fetch the translations, then it would be a rest call each time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Component based localization | Vue I18n
Therefore you can globally translate using $t or $tc in the root Vue instance and any composed component.
Read more >
Component Level Localization with React and Bit
This article will guide you through the steps of creating component-level translations using React. We will also push the translatable UI ...
Read more >
vue.js - Use component based translations in child ...
The component contains child components named c-child . Now, I would like to use the component based translations of c-parent also in c-child...
Read more >
Angular i18n: Methodical Way to Lazy Load Component- ...
Here we are going to understand that real-world problem solution for component-based content translation in Angular.
Read more >
A Component-Based Formal Language Workbench
The definition of the translation is validated empirically by using generated code to execute funcon terms. (manually-written unit tests, and translations of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found