You should really try them again sometime, they are awe-inspiring to me.
note that the solution i last put on the list will refresh automatically when the dataset changes and requires no subclassing. neat-o
P T Withington wrote:
I never get datasets myself. Just to verify that the CSS way works, I did test the following: <canvas layout="axis: y; spacing: 5"> <stylesheet> i18nbutton[name='submit'] { text: "gönder"; } i18nbutton[name="reset"] { text: "reset"; } </stylesheet> <class name="i18nbutton" extends="button"> <attribute name="text" style="text" /> </class> <i18nbutton name="submit" /> <i18nbutton name="reset" /> </canvas> and it works for me. On 2010-02-15, at 19:01, cem sonmez wrote:i am sorry, maybe this thread has become so long bec. of me but donT understand why this happens <canvas> <dataset name="localized"> <string name="submit" value="gönder"/> <string name="reset" value="reset"/> </dataset> <button text="$path{'localized:/stri...@name=\'submit\']/@value'}" /> </canvas> I am just trying this code and see nothing. Cem 2010/2/16 P T Withington <[email protected]>The value of the expression in the $path{} statement needs to be a string, so I think you would need to say: <button text="$path{'localized:/stri...@name=\'submit\']/@value'}" but I have not tested this. On 2010-02-15, at 18:38, cem sonmez wrote:jamesr, I have used your same notation, but i m getting error *Syntax error: the token ":" was not expected at this position.* I have made lots of changes at the $path expression. Still nothinghappensAnother error that i m getting *Lexical error. The source location is for the element that contains the erroneous script. The error may come from an unterminated comment.* Do you have an idea why this happens? Did you used this code snippetbeforeyou post it? And also does anyone have an idea about this issue? Regards Cem 2010/2/15 cem sonmez <[email protected]>Yes i have seen $path before, but i have never used it for anyconstraint.$path usage has been explained well at [1].I will take a look at it again and try this form. Thanks a lot Cem [1] -http://www.openlaszlo.org/lps4.7/docs/developers/databinding.html#d0e964682010/2/15 jamesr <[email protected]>Sure! as PT mentioned, there may be overhead for using the $pathmethodi'll direct you toward, for very large applications. There are a few manager/registry based ways around this overhead, no problem, but the conversation is out of scope to your direct question to get into -- inthisemail.Have you ever used the $path{} form of constraints? they take adataset:datapath pair and bind to a specific location in a dataset, which will update when the dataset changes. From your code snippets i'mguessingyou haven't seen them.if you have a dataset thus, <dataset name="localized"> <string name="submit" value="(submit in another language)"/> <string name="resest" value="(reset in another language)"/> </dataset> then you can set up a path constraint by saying, <button text="$path{localized:/stri...@name='submit']/@value}" and this will *find* the string node with name "submit" (be sure tohaveunique names or you'll get mulitple nodes back and the expression will be invalid) and use its value attribute as the text for the button.more info is in the laszlo docs... i don't have a link to it handy,sorry-j cem sonmez wrote:Thanks all for your replies. But i just can say that i am inexperienced about css. So all along ihave thought to use dataset. The problem is to change the textsdynamicallywhen i set the datapath's src attribute during runtime.But as you said ptw, itS more about skinning, css is more convenienttouse. I will look at it as well.For the dataset usage. It may looks like : <dataset name="dset" src="words.xml" /> <datapointer id="dpointer" xpath="dset:/language"> <method name="getMessage" args="textId"> this.setAttribute('xpath', 'dset:/language'); this.selectChild(); do { if (this.xpathQuery('@id') == textId) { var message = this.xpathQuery('value/text()'); if ($debug) Debug.write("datapointer : " + message); return message; } } while (this.selectNext()); </method> </datapointer> and i also can use it <button name="button1" text="${dpointer.getMessage(1)}" /> I havenT just tried, but the problem is going to occur when i want tochange the dataset src at runtime. jamesr, the way that u mentioned likes mine. Can you instruct a bit more please.thanks all again . Kind regards Cem 2010/2/15 P T Withington <[email protected] <mailto:[email protected]>> Using a dataset is an equally valid approach, but I think it was tried and found to require too much overhead. Of course, if CSS is made dynamic, perhaps it will have equivalent overhead. Perhaps the reason some people think of CSS first is because it seems i18n is like "skinning" or styling your app. On 2010-02-15, at 12:09, jamesr wrote:Would it not be more expedient to write a class, called perhapslocaltext, that takes a single field to index inside of a dataset wherein a given real-world language sentence is kept, so that by changing datasets you change all displayed localized text?Why use CSS? P T Withington wrote:There are two improvements targeted for 5.0 that will help thissituation:LPP-8556 Add default CSS style properties to <view> LPP-7359 Make CSS attribute selectors dynamic There should also be one to make it so you can load astylesheet at runtime, but I can't seem to find that. Maybe Max and I only talked about it...With all three of those, it should be possible to have a singleapp that will be localized when it is loaded. For now, you are correct, you need to compile your app for each language.--- With LPP-7184 Binary libraries don't work in swf9 resolved (andintegrated to 4.7), we believe that LZO's are now fully supported in swf9 for 4.7.1 (soon to be released) and 5.0.x (in development). We'd welcome testing by anyone who needs this feature. Grab the latest 4.7.1 here:http://download.openlaszlo.org/nightly/4.7/ On 2010-02-15, at 11:39, Raju Bitter wrote:All the internationalization based on CSS for Webtop (at leastwiththe version I've used) requires you to recompile the app for a different language. That's not too much of a problem, justgeneratedifferent versions of the app for different languages. It would be good to have dynamic CSS support at runtime, but a workaround could be to put all the strings into an LZO, withdifferentLZOs for different languages. That should work, shouldn't it? Of course you are limited to SWF8 and DHTML then, since there'sstill nosupport for LZOs with AS3 based runtimes, as far as I know. 2010/2/15 P T Withington <[email protected] <mailto:[email protected]>>:I believe some use CSS styles to achieveinternationalization, although currently LZX does not support dynamically changing styles, so I'm not sure exactly how this is handled. Currently, styles need to be pre-processed by the compiler. Ideally, you would have your application server looking at the browser request language preference and serve up different style sheets based on that. It may be that people are using a .jsp to do this kind of dispatching.In theory, you would write something like: <!-- supply style sheet based on browser language --> <stylesheet> i18ntext [label="hi"] { text: "hello" } </stylesheet> <class name="i18ntext" extends="text"> <attribute name="label" type="string" /> <attribute name="text" style="text" /> </class> <i18ntext label="hi" />[...]-- Cem SONMEZ-- Cem SONMEZ-- Cem SONMEZ-- Cem SONMEZ-- Cem SONMEZ
