Hey Bert,
2009/7/18 bert wiley <[email protected]>:
> I have wt compiled on a freebsd 7.2 system and its linked with boost and has
> the ExtJs widgets working without a hitch. I have a simple app im trying to
> make and i cant seem to
> get the text from a xml file to load and display properly. I use the
> following in my class
>
> SomeClass::SomeClass(const WEnvironment& env)
> : WApplication(env)
> {
> setTitle("Welcome");
> useStyleSheet("my.css");
>
> Wt::WApplication* app = Wt::WApplication::instance();
> app->messageResourceBundle().use("intro");
> Wt::WText *welcome = new
> Wt::WText(WString::tr("welcome-visitor").arg("welcome-text"));
>
> root()->addWidget(welcome);
> }
>
> I have the following the in the intro.xml file in the root level of the app.
>
> cat intro.xml
> <?xml version="1.0" encoding="UTF8"?>
> <messages>
> <message id='welcome-text'>
> Welcome dear visiter, {1} of the WFooBar magic website !
> </message>
> </messages>
>
>
> Then when i view the page i see this
>
> ??welcome-visitor??
>
> This must be somthing simple im missing ive tried alot of different things
> with this and still get the same data.
It must be because the resource xml file could not be read.
There is an important distinction between how the files are read:
useStyleSheet("my.css");
and
app->messageResourceBundle().use("intro");
The first call will let the web browser fetch the file "my.css". Since
this is a bare file name, the browser will interpret this as a
relative URL, and fetch the application from the same path as the
application.
The second call will let the application itself read the file
"intro.xml" (and other language variants if needed). Since this is a
bare file name, the file will be read from the current working dir.
The current working dir will depend on how the application is run. I
suspect thus that for some reason, "intro.xml" is not in your working
directory? A quick check could be to set the absolute file path
("/path/to/intro").
It is easy to mixup the semantics of URLs and local files, because Wt
does such a good job in hiding the browser-server distinction !
Regards,
koen
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest