Re: [xwiki-users] relation Code and Translation key's App-Within-Minutes

2016-05-13 Thread Clemens Klein-Robbenhaar

Renaming an app might be a bit tricky, as the generated code contains the name 
of the space / classes / properties in quite a few places.
Maybe global search & replace over the exported pages might work. If there is 
no much customizations recreating the App from scratch might be simpler.

Anyway, about the questions:

What the "$doc.displayPrettyName('date1', false, false)" does, it the following:

 - take the property "date1" from the "current" class (the sheet picks what the 
'current class' is a few lines above; it should be the data structure you have 
defined)
 - it looks up a translation key of the property name for the "current 
language" (whatever the current user has as current language when viewing the 
page)
   the translation key is constructed as:
  _
   the Reference-to-class is the "full path" to the data structure, i.e 
including the space where it is located.
 - if it does not find such a key, it looks the content of the "pretty name" 
field defined on the property itself in the class definition, as a fallback
 - returns whatever is found for display

you can find out what else is available in the "Scripting Reference 
Documentation"
   http://platform.xwiki.org/xwiki/bin/view/DevGuide/API
(look up the $doc and scroll ...) ... but that is full reference, not a 
tutorial ;)


The translations come from plain wiki pages with a special "marker object", see:

  
http://extensions.xwiki.org/xwiki/bin/view/Extension/Localization+Module#HRegisterawikitranslation


Finally the $escapetool.xml makes sure special HTML-characters like '"' and '&' 
in the display title are properly escaped / encoded and do not break the layout.
(There used to be an $escapetool.html but that one the one escaped too much, on 
the other hand did no escape single quotes due to a literal understanding of 
the spec ... thus $escapetool.xml it is.)
Do not remove it, even if it seems to work for you now ... you never know what 
translations etc might happen

This should all work without client side javascript involved.


Hth
Clemens

> Hi
> 
> I'm struggling to understand the relationship between the code generated by 
> App-With-Minutes for the Sheet and the Generated translation files; 
> Especially if I want to rename application, page, class) (or copy it to 
> another wiki)
> 
> #set ($discard = $services.localization.use('document', 
> 'WaihonaCode.qbgTranslations'))
> (% class="xform" %)
> (((
>   ;  for="WaihonaCode.qbgClass_0_date1">$escapetool.xml($doc.displayPrettyName('date1',
>  false, false))
>   : $doc.display('date1')
> ...
> )))
> 
> The space WaihonaCode is where class, sheet and template are located
> 'date1' is the class attribute we need a translated text
> 
> This is what is generated in the translation file:
> # Class fields
> WaihonaCode.qbgClass_date1=Date
> 
> Since we do not see any $services.localization.render("date1") i'm uncertain 
> how the key is created? (what logic is applied?)
> Why is there: $escapetool.xml($doc.displayPrettyName('date1', false, false))?
> Why escape tool?
> what is the function of the method displayPrettyName('date1', false, false))?
> 
> 
> Is there any client side functionality (JavaScript) required for this to work?
> 
> 
> Gerritjan Koekkoek
> Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
> Visit our website
> Facebook
> email
> 
> 
> 
> ___
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
> 

mit freundlichen Grüßen
Clemens Klein-Robbenhaar

-- 
Clemens Klein-Robbenhaar
Software Development
EsPresto AG
Breite Str. 30-31
10178 Berlin/Germany
Tel: +49.(0)30.90 226.763
Fax: +49.(0)30.90 226.760
robbenh...@espresto.com
www.espresto.de

HRB 77554 B - Berlin-Charlottenburg
Vorstand: Maya Biersack, Peter Biersack
Vorsitzender des Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber
Zertifiziert nach ISO 9001:2008
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] relation Code and Translation key's App-Within-Minutes

2016-05-12 Thread Gerritjan Koekkoek
Hi

I'm struggling to understand the relationship between the code generated by 
App-With-Minutes for the Sheet and the Generated translation files; Especially 
if I want to rename application, page, class) (or copy it to another wiki)

#set ($discard = $services.localization.use('document', 
'WaihonaCode.qbgTranslations'))
(% class="xform" %)
(((
  ; $escapetool.xml($doc.displayPrettyName('date1',
 false, false))
  : $doc.display('date1')
...
)))

The space WaihonaCode is where class, sheet and template are located
'date1' is the class attribute we need a translated text

This is what is generated in the translation file:
# Class fields
WaihonaCode.qbgClass_date1=Date

Since we do not see any $services.localization.render("date1") i'm uncertain 
how the key is created? (what logic is applied?)
Why is there: $escapetool.xml($doc.displayPrettyName('date1', false, false))?
Why escape tool?
what is the function of the method displayPrettyName('date1', false, false))?


Is there any client side functionality (JavaScript) required for this to work?


Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website
Facebook
email



___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users