I have created a root annotations file which does reference an annotations file. But all annotations are ignored. If I include the annotations in the root annotation file everything works fine.
The root annotation file:
*<GoogleCustomizations>
<Include type="Annotations" href="http://myhost.net/System/GoogleCustomSearch/SozialversicherungAnnotationsSiteList.xml"
</GoogleCustomizations>*
The annotations file:
*<?xml version="1.0" encoding="UTF-8" ?>
<Annotations>
<Annotation about="http://www.tagesanzeiger.ch">
<Label name="_cse_xyxyxyxyxyx"/>
</Annotation>
</Annotations>*
Thanks for any help!
I have solved my problem when I read the instructions found at Linked Custom Search Engine
You have to include the link to your xml file hosted on your site in the CSE url with the cref param and remove the cx param as well.
With the help of the excellent Google support I could solve my problem. The solution is:
Upload the root annotations file under the section "Annotations-Feeds" and not under the section "CSE-Annotations". (The root annotations file and the referenced annotations file as shown in my question are correct.)
Wait up to 72 hours until the changes work.
If you want to search a whole website, don't forget to add the wildcard character (e.g. "www.tagesanzeiger.ch/*" and not just "www.tagesanzeiger.ch").
Related
I have configured in TS setup: markerFile = path to file de.locallang_marker.xlf
<trans-unit id="p_category" resname="p_category" approved="yes">
<source>Category</source>
<target state="final">Kategorie</target>
</trans-unit>
How do I use this now in the template?
Since tt_products uses "old style templates" with markers, the markers used in the template are mainly used to fetch data from the DB like ###CATEGORY_TITLE###. But I havn't seen anywhere in the example templates markers to get some translated texts!
Help appreciated
Regards
Karl-Heinz
found the solution:
I used:
###p_category###
but it must be in capital letters
###P_CATEGORY###
I googled the following questions, but answers to them I was unable to find. They are interrelated so I am putting them together in one post. I am a Java backend developer using Eclipse IDE, using JSTL fmt:message tags in a Maven Spring 4 Java project.
Question #1:
If you have a jsp file, that includes another jsp file in it, where does the fmt taglib go?
Question #2:
Can the fmt:setBundle tag have a nested fmt:message tag?
Question #3:
Where does the message.properties file have to be located for use with the fmt:setBundle tag?
Answer #1:
If you are going to use fmt:message with fmt:setBundle and fmt:setLocale, you will need the fmt taglib. This is obvious I am sure. However, in addition, if you have a jsp file, that includes another jsp file, using the jsp:includes tag, and the included file is the one that contains the fmt tags, then the fmt taglib goes into the included file, and NOT in the wrapper file.
<%# taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
Answer #2:
I was unable to get the following to work. Eclipse said that the fmt:setBundle tag must be empty. However, I did see examples on the web that nested the fmt:message tag within open and close fmt:setBundle tags.
<fmt:setBundle basename="message">
<fmt:message key="name"/>
</fmt:setBundle>
See: https://www.baeldung.com/jstl
I WAS able to get the following to work.
<fmt:setLocale value="en_US" />
<fmt:setBundle basename="com.studypartner.properties.message" var="lang"/> // approach #1
<h1><fmt:message key="name" bundle="${lang}" /></h1>
<fmt:setBundle basename="message" var="lang"/> // approach #2
<h1><fmt:message key="name" bundle="${lang}" /></h1>
To make this code i18n, you can set the locale to whatever you want from the list of language_COUNTRY codes, and if you have a matching property file, the code above will print the value of key "name" to the page. For instance, I created a properties file called "message_en_US.properties". Since I set the locale to "en_US", and the end of the basename is "message", the properties file I have will be found and the key "name" that is in this file, that matches the fmt:message tag, will end up in the tag above. That part about "lang" in the tags above just seems to be necessary to link the bundle to the message.
See: https://www.tutorialspoint.com/jsp/jstl_format_message_tag.htm
Here's a list of language and country codes:
https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html
Answer #3:
Ok, look at the code for "approach #1" and "approach #2" again, in Answer #2. Why did I repeat it? I wanted to prove that either approach will work. It seems that it is important to place the properties file in the correct location. However, in a Maven Spring 3 Java web project, you can locate it in a few surprising locations, and it will work for any of them. Take a look at the project setup in the link below:
project setup
First, if you don't have a message_en_US.properties file, but you do have a message.properties file, then the fmt:setBundle tag will still work. Also, you can place your properties file in 3 different places, and it will still work.
a) src/main/java > com.studypartner.properties
b) src/main/resources > com > studypartner > properties
c) src/main/resources
"a" and "b" work for
"c" works for
Where of course you would replace "com.studypartner.properties" with your own package name (a, b) or name of nested folders (c).
Basically, this is what they mean when they say that the properties file has to be on your "classpath".
I basically want short URLs to get resolved and HTML pages to be generated with short URLs for a CQ5 website. So far short URLs are getting mapped to long URLs as expected, but links in the generated HTML pages are not getting shortened.
For example, I am expecting the src attribute of the following <script> tag:
<script type="text/javascript" src="/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/style/clientlibs.1395978029951.js"></script>
To be shortened to:
<script type="text/javascript" src="/style/clientlibs.1395978029951.js"></script>
But it is not and remains intact. href attributes in anchor elements are not getting shortened either.
In JCR, the website is stored under /content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/ and I have configured my /etc/hosts and Apache config files to make it accessible via http://site-1:4503 in my local development environment.
I have defined the following URL mappings:
{
"jcr:primaryType":"sling:Folder",
"http":{
"jcr:primaryType":"sling:Folder",
"site-1.4503":{
"sling:internalRedirect":[
"/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae"
],
"jcr:primaryType":"sling:Mapping",
"redirect":{
"sling:internalRedirect":[
"/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/$1",
"/$1"
],
"jcr:primaryType":"sling:Mapping",
"sling:match":"(.+)$"
}
},
"site_1.4503":{
"sling:internalRedirect":[
"/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/home.html"
],
"jcr:primaryType":"sling:Mapping",
"sling:match":"site-1.4503/$"
}
}
}
When I test this mapping in JCR Resolver (http://localhost:4503/system/console/jcrresolver), it is working as expected. For example,
/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/style/clientlibs.1395978029951.js
is mapped to
http://site-1:4503/style/clientlibs.1395978029951.js
and
http://site-1:4503/style/clientlibs.1395978029951.js
is resolved to:
JcrNodeResource,
type=cq:ClientLibraryFolder,
superType=null,
path=/content/foo/c0/06/9d/3d93a858-efb4-4619-8f9e-5edc65d0f5ae/style/clientlibs
Also when I go to http://site-1:4503/style/clientlibs.1395978029951.js in my browser, the JS file is rendered as expected.
However when I view the HTML source for the home page, as I mentioned earlier, none of the long URLs are rewritten to their shortened forms.
Any ideas what am I missing here?
By default, CQ rewrites links in a, area and form tags. If you'd like to rewrite also paths in script tag, open OSGi configuration for LinkCheckerTransformerFactory service on publish and add following string to the Rewrite Elements option:
script:src
BTW: /content is not the best place for storing clientlibs. Usually we put this stuff in /etc/designs/YOUR_APP.
We finally managed to pinpoint the issue and fix this.
Somebody had added a com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl.xml under /apps/myapp/config.publish with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
service.bad_link_tolerance_interval="{Long}48"
service.check_override_patterns="[^.]"
service.special_link_patterns=".*
"
service.special_link_prefix="[javascript:,data:,mailto:,#,<!--,${]"/>
I think the combination of check_override_patterns and special_link_patterns had disabled link shortening.
Removing this file made link shortening work again.
I have created a custom Plone content type in my package i.e. my.product.
I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.
Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?
I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:
diff_tool.xml
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
</difftypes>
</object>
repositorytool.xml
<?xml version="1.0"?>
<repositorytool>
<policymap>
<type name="MyCustomType">
<policy name="at_edit_autoversion"/>
<policy name="version_on_revert"/>
</type>
</policymap>
</repositorytool>
I have never used plone.app.iterate, but this is the generic approach how to solve the problem.
Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml
Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.
The view is defined here
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/configure.zcml#L7
The checks that are performed for the content item if it's archiveable
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/control.py#L47
Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.
Currently I try to fix a issue on our SocialEngine installation (which is built on Zend) which shows in the language selector one language not in its native name (like "Deutsch" for "German") but in the language the user has set the frontend (so instead of "Deutsch" you would see "German" when you set the language to English).
When looking in the source I've seen that Zend_Locale_Data loads a list of languages which are available for the system and tries to read a LDML file from a path which seems not to be on my machine:
$temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language', 'type');
When the path is not on my computer, it has to be in the web but doing a search for "ldml" or "zend ldml" I don't get any hint on this topic. Could you guide me through the fog?
Any help is appreciated. Thank you!
The '/ldml/localeDisplayNames/languages/language' that you see is not a file path but a XPath expression, the file that is read is an XML file located in Zend/Locale/Data/ and the filename is related to the given $locale parameter.
e.g. For the english locale, the XML file loaded should be Zend/Locale/Data/en.xml. Opening this file will show you the structure selected by the XPath expression
<?xml version="1.0" encoding="UTF-8" ?>
<ldml>
<!-- content skipped -->
<localeDisplayNames>
<!-- content skipped -->
<languages>
<language type="aa">Afar</language>
<language type="ab">Abkhazian</language>
<!-- etc... -->