Comments (4)
You forgot to start the services, the localization service loads the translations. You can take a look at createPublicRoot
in self_order_index.js
of the pos_self_order
module as an example, as the new pos self ordering app is an owl app served from a controller. But indeed this is not the appropriate repo for this question.
from owl.
we should have a howto on the official owl documentation for a setup for a controller in odoo with a minimal set of files, owl, templates properly setup, and translations as well
from owl.
task created id=3580007
from owl.
we should have a howto on the official owl documentation for a setup for a controller in odoo with a minimal set of files, owl, templates properly setup, and translations as well
That would be super helpful!
You forgot to start the services, the localization service loads the translations. You can take a look at createPublicRoot in self_order_index.js of the pos_self_order module as an example, as the new pos self ordering app is an owl app served from a controller. But indeed this is not the appropriate repo for this question.
Thanks for the quick reply @sdegueldre, sometimes it is difficult to pinpoint if its an issue on the owl side or Odoo side. I've added the startServices()
as per your recommendation:
if (document.querySelector('#some-div')) {
await whenReady();
const env = makeEnv();
await startServices(env);
mount(
ExampleComponent,
document.querySelector("#some-div"),
{
env, templates, translateFn: _t, dev: true }
);
}
However, I am now faced with all sorts of errors in the console (it even gets in a loop of errors):
Error: Cannot add 'EffectContainer' in the registry: it already exists
Error: Cannot add 'DialogContainer' in the registry: it already exists
Error: Cannot add '...' in the registry: it already exists
TypeError: Cannot redefine property: userContext
OwlError: Cannot make the given value reactive
TypeError: env.services.dialog.add is not a function
Error: UI service not initialized!
I tried to mount an App
instance instead of the component itself as per the example you suggested (POS self order), however that did not solve it:
import { Component, whenReady, App } from "@odoo/owl";
const app = new App(ExampleComponent, {
templates,
env,
dev: env.debug,
translateFn: _t,
translatableAttributes: [],
});
app.mount(document.querySelector("#some-id");
Perhaps you have any suggestion?
cc @ged-odoo
from owl.
Related Issues (20)
- t-esc="item.description" in a slot in a t-call in a t-foreach: only description of the last item is displayed HOT 2
- integrate owl and 3D js libraries HOT 1
- create a `owl-extra` library, with basic useful features HOT 3
- Error generated when using new Function() constrcutor in templating due to Content Security Policy blocking unsafe generated js code HOT 1
- duplicate parseXML code
- Is there has a hook like the useLayoutEffect in react? HOT 1
- Navigation through components in v2.0+ HOT 2
- Reactivity: only subscribe components during rendering
- do not destroy new components with equivalent props if rerendered before being mounted
- templates with xml helpers should look for t-set= instead of t-set HOT 1
- Question HOT 1
- Problem while using of useService HOT 14
- [16.0]How to initialize/mount properly a component in a website / portal view HOT 13
- Documentation for slot params shows bad example HOT 1
- Component gets improperly patched
- Don't allow invalid modifiers on events
- t-ref is no longer supported on components. Consider exposing only the public part of the component's API through a callback prop. HOT 3
- useService("user") doesn't work with public component HOT 6
- Question: Mounting component with javascript HOT 2
- [crash] slot content re-renders when it should be destroyed HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from owl.