Freemarker format BigDecimal to German Locale using inline method - double

As a continuation of this question , i want to ask the following :
I want to add the German Format to a number but not apply it to whole document like using :
<#setting number_format="0.##">
<#setting locale="de_DE">
German people write: ${12345678}
Is there something like ... ?
${numericalValue?locale("de_DE")}
Or i should open a feature request for it on free marker github repository ?

There is no such feature out of the box. Though anything is possible with custom formats (see https://freemarker.apache.org/docs/pgui_config_custom_formats.html).

Related

How can I find and edit/delete links from a Word document before JS requirement set 1.4?

I'm developing a MS Word Add-In using the JS API. Currently, I need to find and edit or delete specific links inside the entire document. I know that this works using context.document.body.fields and then item.result.delete() and item.result.insertText('new text', 'Replace'). But context.document.body.fields is only available in the latest versions of Word (technically since requirement set 1.4).
I just want to know, are there alternative ways to do this in older Word versions before rs 1.4? And if so, what are those?
I think you can use document.body.search() method to find the hyperlink and this method will return a Range object, you can futher call something like InsertText() to replace it or call range.hyperlink = "" to remove the hyperlink.

What is the correct way to specify DC metadata for a multi-language ePub?

I am developing an ePub. In the content.opf file I have to specify a series of metadata by using DC standard. For example dc:title and dc:creator.
However my book is a multilanguage book, that is, it contains two translations of the same text: English and Russian. The standard reference manual states that I can have more dc:language statements. For example:
<dc:language>en</dc:language>
<dc:language>ru</dc:language>
but it does not say how to specify the other metadata for more than one language. Consider, for example, dc:creator. I tried
<dc:creator xml:lang="en">Dario de Judicibus</dc:creator>
<dc:creator xml:lang="ru">Дарио де Юдицибус</dc:creator>
I get an error from the distribution platform validator, which states that the format of ePub is not correct. It looks like I cannot use xml:lang in dc:creator even if, in theory, that is an XML attribute that can be used with any XML tag. Same for dc:title:
<dc:title xml:lang="en">My Book Title</dc:title>
<dc:title xml:lang="ru">Название Mоей Kниги</dc:title>
Could someone who has had to face the same problem as me, namely writing the OPF for an ePub that contains a text in multiple languages, tell me what is the correct way to do it? In the standards for the OPF 3.x I have not been able to find any useful information to establish this.
SOLVED
I verified my code with one of the author of the W3C specifications for OPF and he told me that what I wrote is correct, but that some validator is not used to multi-language documents, so that the problem is the validator, not the code. I write this in case someone else may have the same problem.

Locale function?

Is there a server side function in SFCC to get Locale? Thank you!!!
I am localizing a sfcc site, and need to update the en_gb locale in thousands of hard coded strings (in a xml file obtained from Merchant Tools > Content > Import & Export) to server side code that will dynamically insert the correct locale, i.e. en_gb, fr_fr, etc. I know there are a few server side functions like $URL()$ that can run before content is rendered. Is there one to get the Locale?
here is what I have now... https://www.example.com/en_gb/holiday-sale-event/?prefn1=productType&prefv1=Shoes
ideally, I'm looking for something like: https://www.example.com/$Locale()$/holiday-sale-event/?prefn1=productType&prefv1=Shoes
Expected results would be:
https://www.example.com/en_gb/holiday-sale-event/?prefn1=productType&prefv1=Shoes
https://www.example.com/en_nl/holiday-sale-event/?prefn1=productType&prefv1=Shoes
https://www.example.com/fr_fr/holiday-sale-event/?prefn1=productType&prefv1=Shoes
https://www.example.com/de_de/holiday-sale-event/?prefn1=productType&prefv1=Shoes
...etc., depending on locale.
You should be using $url()$ to generate the URL which will automatically populate the correct locale string in the URL.
Assuming that the above examples are links for a refined category search within a category with the ID: holiday-sales-event Then your first example would be represented as such:
$url(Search-Show,cgid,holiday-sales-event,prefn1,productType,prefv1,shoes)$
This would produce the correct localized URL for whatever locale context the content is being rendered for.
Since the “holiday-sales-event” portion of the URL is likely to be localized itself, then your intended approach would result in either 404s or redirects at the very least.
you can get the current locale with request.locale
var currentLocale = request.locale;

can you limit the number of items in a recently-updated macro in confluence 2.9?

i see in confluence 2.10, there is a max and maxresults parameter but i dont see these parameters in 2.9.1 or below. Is there anyway to limit the results in these versions ?
There's no such parameters in 2.9, you could use the {rss} macro and display a confluence feed of recently updated content, but you would have to transmit a username and password inside the url, plus the resulting page will either simply display the list of page title (no space, no author nor date) or the complete diff/content for the page (a bit noisy).
A more practical way of limiting the number of results shownwould be to use the GET parameter maxRecentlyUpdatedPageCount which control the {recently-updated} macro behaviour.
In order to do that, you could use the {redirect} macro (it's in a free plugin) on your page. Supposing your page is located at http://confluence.example.come/display/SPACE/Page, its source will look like (for 50 recently update items) :
{recently-updated}
{redirect:location=http://confluence.example.come/display/SPACE/Page?redirect=false&maxRecentlyUpdatedPageCount=50}
Note that it will display a slightly annoying information panel, warning you about the redirect. If you want to get rid of it, get your hands on the {span} macro (free plugin as well), and change the markup of the page to :
{recently-updated}
{span:style=display:none;}
{redirect:location=http://confluence.example.come/display/SPACE/Page?redirect=false&maxRecentlyUpdatedPageCount=50}
{span}

Query with toLocalizedTime in Plone

I'm using toLocalizedTime to output a date, as below
<span tal:content="python:here.toLocalisedTime(date.get('start_date'))"/>
This outputs eg. 2007/08/02, I'm just curious as to how one would alter the output so that it reads 02/08/2007
I'm not having much luck finding much info on toLocalizedTime, would someone point me in the right direction?
This depends on whether you have English selected as the site language (Site Setup >> Language). If so, then the default settings are used. You can change the defaults by dropping down into the ZMI, then into 'portal_properties', then 'site_properties'. The fields to change are either 'localTimeFormat' or 'localLongTimeFormat' depending on whether you pass in 'long_format=1' to the toLocalisedTime function.
If on the other hand, you have translations set up, the format may instead be pulled from the translation file for the locale selected. I'm not sure what is the easy way to change the format in this case (other than switching the site back to English). I guess you can register your own translation file but I've never needed to do that so you're going to have to look up the details.
Date string formatting follows the Python rules (http://docs.python.org/library/time.html#time.strftime).
Perhaps even more detail than you need:
here.toLocalizedTime()
is defined in the plone browser view at...
CMFPlone/browser/ploneview.py
which looks up the 'translation_service' utility, to call its 'ulocalized_time' function, defined at...
CMFPlone/TranslationServiceTool.py
which itself calls the 'ulocalized_time' function defined at...
CMFPlone/i18nl10n.py
As always, you can learn interesting things by grepping the source code ;-)
For an up to date answer for Plone 4.3 (after going through the source code)
These fields are now in the registry found at:
http://localhost:8080/yoursite/portal_registry
Then filter on "i18nl10n", which should give you the 4 fields you need to change.