New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: init workspace for vue webapp #2546
base: main
Are you sure you want to change the base?
Conversation
Hey @zklosko, is there more work you want to put into this PR ? Have you come up with a good way to embed the Vue multipage views into the legacy app ? I also have a branch with a POC that embeds some Vue pages into the legacy app, but it didn't feel clean enough to propose a PR yet. I am currently focusing on the new auth system, which is required for the new UI to work. What is your plan in regard to this PR and with more generally the web app ? |
Hi @jooola! My goal is to set up a base dev environment with configured plugins and CI so we have a good foundation to start building the new UI. I haven't thought about embedding into the new app. Was planning to do the widgets first since they can be served separately. Once we have the building blocks, I would want to start redesigning from the ground up. It doesn't make sense to move from Bootstrap to Material design frameworks and then endlessly mold the CSS so it looks just like the old UI. I would want to make a new UI and then release it all together as Libretime 4.0. |
I've been getting very friendly with Vue 3 lately. How can I help? |
I believe I have a really basic about page set up as a demo. It mostly copies from the front page of our docs site. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 general things:
- How are the translation JSON files generated? Can you add instructions to the README?
- How would we go about embedding this /about into the legacy app?
I translated the .po files using something like Localize.biz or an npm package with a CLI. It's decoupled from our Weblate workflow. Haven't thought too much about embedding the page, but I have it set up to generate a static site so we can serve an HTML file from |
Do we have a way of generating a list of strings or keys from the strings used? Otherwise updating the set of translation source strings is difficult |
I could write a node script to print all keys to a text file but I'm not sure Weblate requires that. Looking at their documentation, it seems like Weblate is fully compatible with the json files that Vue-i18n needs. Also see: https://docs.weblate.org/en/latest/admin/projects.html#component
|
Maybe I am misunderstanding the JSON files, but they map a key used in the code to the translated string right? I'm asking about the mapping from used keys in the code to create the JSON files. For example, a new string is added to a view. How does that key end up in all the JSON files? |
webapp/vite.config.ts
Outdated
server: { | ||
port: 8080, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already use that port for other services, please remove and use the default.
eslint should be capable of checking if an i18n key used in the code is missing from the translation files. Maybe also the other way around. But I would start with empty i18n json files, as we don't (almost) use translated strings yet. The development setup should also take advantages of the vite dev server, e.g.: <script type="module" src="http://localhost:5173/src/main.ts"></script> |
Translation strings are imported globally, then selected by key for templating':
or as part of
I think you're thinking about it backwards. You would need to have a key:value pair in your JSON i18n translations before adding the string to a view as an i18n translatable string. It isn't automatic. All new strings would need to be added manually. For example, if we wanted to have a greeting message, we could have key:value I know we have a few longer blocks of text with HTML tags that we would like to translate. Instead of having i18n strings for those, we may want to have markdown files (one per language) that we could render in the view so we can have more intricate explanations for things. For example, the following would be less practical, but not impossible, to do as a key:value pair:
I think it's mainly the other way around. I found this, but it cleans out unused i18n strings from your locale files.
There isn't a need to do that. |
I would prefer to have keys here instead of the en_US string, I think I mentioned this already before. e.g.:
I meant within the legacy page. Development will happen on the legacy page,so the php code should be able to load the webapp files and take advantages of the vite dev server. |
That is the key. In this instance, the key is also the en_US string.
I don't understand. Why can't we build and then serve the built pages instead of running through the dev server? Running through a dev server is much less secure and could be harder to rectify for a user if it crashes. This really doesn't seem like the simplest way forward. |
Yes, this is the current behavior with the PO files. Now that we have json files and vue-i18n, I would like to use keys instead (e.g.
We have 2 environments, production and development. For production, we compile the multiple web app pages and serve them using some web server, the files aren't meant to change. For development, we will have to change the files often, and test the changes, we cannot rebuild the production setup every time. Vite has a powerful development server, so we need to leverage this and use it in the dev setup while we develop the web app. This allows use to have hot reload, dev tools integration, and so on... |
Wouldn't doing this break any test builds we would do for the new web app? |
How would it break tests? |
If we're hard coding the URLs of script sources, it won't run on its own without that exact port setup. If we did that during dev, we would need to switch everything back and test it for production. |
We leverage the app environement config to either setup the dev server or serve the production files, so this is not a problem. The legacy dev setup will point to the webapp dev server, and the production with reference the files from the webapp build manifest. This just needs a bit of php code, nothing fancy |
@jooola Something like this for translations?
|
Yes, though I'm not sure this is actually a good idea with how weblate works. Using a source language helps translators know what meaning the string is supposed to have in the context that it is used. |
Description
Initially started in #1696, starting again from scratch following feedback from lead maintainers.
This PR creates a development environment for the rewrite of Libretime's web user interface. The environment is based on Node 18.12.0 LTS and includes Vue 3, Vuetify 3, Vite, Cypress, Storybook, vue-i18n, Eslint, and Typescript.
I have updated the documentation to reflect these changes:
No documentation updates for now. Getting started notes are in Readme.MD.
Todo
Links
Closes #1121