Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Implement multilanguage support in the vue frontend application #73

Closed
dneukirchen opened this issue Dec 28, 2016 · 11 comments
Closed

Implement multilanguage support in the vue frontend application #73

dneukirchen opened this issue Dec 28, 2016 · 11 comments

Comments

@dneukirchen
Copy link
Contributor

  • Use the default joomla language files

Vue Plugins:

@dneukirchen dneukirchen self-assigned this Dec 28, 2016
@dneukirchen dneukirchen added this to the Milestone 1 milestone Dec 28, 2016
@laoneo
Copy link
Contributor

laoneo commented Dec 29, 2016

We can also use the Joomla way Joomla.JText._('COM_MEDIA_LANGUAGE_STRING');.

@dgrammatiko
Copy link
Contributor

I will also support @laoneo way, for the default joomla language files

@yvesh
Copy link
Contributor

yvesh commented Dec 30, 2016

I told you @dneukirchen :)

@dneukirchen
Copy link
Contributor Author

With plugins like https://github.com/kazupon/vue-i18n we will also use the default joomla language files (.ini´s).

I dont like Joomla.JText and i think the technique is not ment to be used with powerful tools like vue, angular and react. It feels more like the quick and dirty solution, but i will give in to the majority.

@mbabker
Copy link
Contributor

mbabker commented Dec 30, 2016

The "issue" with Joomla.JText is it requires you to preload strings on the PHP side so they can be used with a request, it's not designed for a JavaScript frontend at all like a Vue or Angular or React. Honestly, it'd be nice if we could do something similar to https://github.com/willdurand/BazingaJsTranslationBundle that creates a way to expose a language catalogue to the JS API, but that would also mean making JLanguage smart enough to be able to create a compiled catalogue with all the strings (and that's also impossible because of extensions overriding strings defined in other files so some of the JLIB_* strings have different text based on the active extension versus having a proper one key per string globally definition; funny enough I've got code to build the cached catalogue but it gets refreshed on so many page loads because of key overloading it's useless).

Though to be honest, Joomla as it is built isn't really designed to be used with a JavaScript application framework. So none of the existing tooling will just "plug" into a totally new application architecture. There's no winning solution to that issue.

@laoneo
Copy link
Contributor

laoneo commented Jan 3, 2017

But are the ini files not automatically loaded on the first page request? And the ajax requests should return only translated data anyway. So why should it be a problem to use JText then from technical point of view?

I'm aware that there are better ways to bring in translations, but JText is the Joomla way and there will be a learning curve when we go with the vue approach, so when we can use existing Joomla functionality, then I think it twill make the entrance for others easier.

@dneukirchen
Copy link
Contributor Author

dneukirchen commented Jan 3, 2017

I agree with @mbabker, but i think the feature (generate a compiled language string catalogue) is out of the scope of this project and could be a project on its own (especially when you have to find a clean solution for the overloading issue).

And for JText vs. vue i18n plugin:
The differences between those two techniques are not so big in our current usecase. We can go with JText::script for now, but this might have an impact on future decisions
(e.g. iframe vs. embed modals, vue for more parts of the backend, ...)

Lets discuss this in the next meeting.

@mbabker
Copy link
Contributor

mbabker commented Jan 3, 2017

FWIW if there's anyone ever interested in toying with the compiled catalogue idea, this is the rough plugin code I've been playing with.

plg_system_languagecache.zip

@laoneo
Copy link
Contributor

laoneo commented Jan 4, 2017

What we need to do is to encapsulate that translation stuff into one place in vue. So when we want to change it on some point, then we have one function to change.

laoneo pushed a commit that referenced this issue Feb 23, 2017
@laoneo
Copy link
Contributor

laoneo commented Feb 24, 2017

I made a first approach with a mixin which uses JText in pr #100. Later we can change it then to something more sophisticated when there is a need.

@dneukirchen
Copy link
Contributor Author

Thanks allon.

@dneukirchen dneukirchen moved this from Issues to Done in Reworked Listview and file browser Mar 21, 2017
laoneo pushed a commit that referenced this issue May 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

5 participants