typo3 tt_products language file - typo3

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###

Related

DITA: reuse the same text multiple times with different variable setting for each instance

I'm working on a document where, among other things, I need to explain two units that are very similar. I want to reuse text in both descriptions, but I want to use the name of the units in the shared text, and to configure a form of substitution/variable so the name of the units appear in each description. Note that the description of both units appear in the final document.
We're using a structure like this:
top.ditamap, which includes:
units_a_and_b.ditamap, which includes:
unit_a.dita
unit_b.dita
and then this file with text snippets:
unit_a_b_shared.dita
unit_a.dita and unit_b.dita will conref text snippets from unit_a_b_shared.dita.
So basically I want unit_a_b_shared.dita to contain something like this:
"When you configure DOODAA to ..."
and then I want DOODAA to be replaced with unit_a inside the unit_a part of the document, and with unit_b inside the unit_b part.
I've tried to use keywords for this, but so far without success. I haven't found a way to make them take on different values in the different files, even when using keyscopes as explained here:
https://blog.oxygenxml.com/keyscopes/keyscopesBlog.html
The problem seems to be that with keyscopes I need the full path, which includes which unit it is, and hence cannot be used in the text snippet which is shared. Without keyscopes the first definition of the keyword applies everywhere.
Any suggestions on how to achieve this goal (using keywords or not)?
I wrote that key scopes article on the Oxygen XML Blog and I think that key scopes seem to be the answer for your case.
So the "unit_a_b_shared.dita" file would have inside a something like:
<p id="reusablePara">some text before <ph keyref="unit"/> some text after</p>
And then in the DITA Map you would refer to ""unit_a_b_shared.dita"" in different key scopes and re-define the key "unit" in those places to bind it to a different value.
The DITA Map would need to look like this:
<map>
<title>Main</title>
<topicref href="unit_a.dita" keyscope="unitA">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KM</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
<topicref href="unit_b.dita" keyscope="unitB">
<keydef href="unit_a_b_shared.dita" keys="reusables"/>
<keydef keys="unit">
<topicmeta>
<keywords>
<keyword>KG</keyword>
</keywords>
</topicmeta>
</keydef>
</topicref>
</map>
and inside "unit_a.dita" you would conkeyref to the reusable paragraph inside the "unit_a_b_shared.dita" file:
<p conkeyref="reusables/reusableParagraph"/>
Note that I'm using "conkeyref" not "conref". Once you get to use key scopes you should avoid direct links or direct content references, use only indirect linking using keys.

TYPO3 Mask: language labels

I try to translate some labels in a mask content element (TYPO3 10). I first created the mask element and mask created a directory "typo3conf/ext/mask_project". I created the file "typo3conf/ext/mask_project/Resources/Private/Language/locallang.xlf" and put a label "read_more" in there.
In my FLUID template ("typo3conf/ext/mask_project/Resources/Private/Mask/Frontend/Templates/Staff.html") I tried:
<f:translate key="EXT:mask_project/Resources/Private/Language/locallang.xlf:read_more" />
<f:translate key="LLL:EXT:mask_project/Resources/Private/Language/locallang.xlf:read_more" />
Unfortunately nothing is printed out. Does anyone has an idea?
The LLL:EXT:...:... syntax is correct (https://docs.typo3.org/other/typo3/view-helper-reference/10.4/en-us/typo3/fluid/latest/Translate.html) for accessing full paths. For the default file location, you would usually not have to add the whole path (this depends a bit on the FLUIDTEMPLATE configuration). In your case you can also use the ViewHelpers extensionName= parameter.
Some hints if you still get no output:
For new labels to be known, you'll need to clear the system cache.
https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Internationalization/XliffApi.html
https://docs.typo3.org/m/typo3/book-extbasefluid/master/en-us/9-CrosscuttingConcerns/1-localizing-and-internationalizing-an-extension.html

Using JSTL fmt:message in a Eclipse IDE Maven Spring 4 Java Web Project

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".

Naming sections with docco/markdown?

Using CoffeeScript and Docco, sections are created in the generated HTML which can then be used as links eg.
geometry.html#section-82
Does anyone know if there is a way to name these sections so it could instead be (for example):
geometry.html#vector
EDIT: It would seem this can be achieved by simply adding in the HTML manually:
**MARKDOWN**
# ## <section id='vector'>Vector:</section>
but is there any other, perhaps more elegant ways?
Currently the best way I can find to do this is as follows:
# ## <section id='vector'>Vector:</section>
It seems to work pretty well, wish I could add it to Markdown though.

How to i18N localize the header of a tab in GWT TabLayoutPanel

I am unable to use the usual i18N localization of GWT to localize a tabs name ('header') in a TabLayoutPanel.
This works:
<g:TabLayoutPanel addStyleNames='LocationsModule' barUnit="PX" barHeight="30" >
<g:tab>
<g:header>Locations</g:header>
But I can't get any other version to work:
<g:header text='{messages.layersTabTitle}' />
or
<g:customHeader>
<g:Label text='{messages.locationsTabTitle}' />
<g:Label>'{messages.locationsTabTitle}'</g:Label>
</g:customHeader>
anyone been able to do this, without resorting to code?
I think you need to use a slightly different syntax here:
check this example:
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/uibinder/test/client/I18nMessageTest.ui.xml?r=7940
so it should be something like:
<g:customHeader>
<g:Label><ui:text from="{messages.locationsTabTitle}" /></g:Label>
</g:customHeader>
You can also use the ui:text element directly within the g:header element, avoiding the need for g:customHeader or g:Label, e.g:
<g:header><ui:text from="{messages.locationsTabTitle}" /></g:header>
(This is similar - although not quite the same - to how the file linked to by Arne uses ui:text within an h2 element: http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/test/com/google/gwt/uibinder/test/client/I18nMessageTest.ui.xml?r=7940)
Tested in GWT 2.4.0.