I want to do a Multilingual Version of my Extension. In case of this I completed the Resources/Private/Language/locallang.xlf
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<xliff version="1.0">
<file source-language="de" datatype="plaintext" original="messages" date="2014-12-16T23:29:45Z" product-name="rere" target-language="en">
<header/>
<body>
<trans-unit id="tx_rere_domain_model_note">
<source>Note</source>
<target>Note</target>
</trans-unit>
<trans-unit id="tx_rere_domain_model_note.notenr">
<source>Notenr</source>
<target>Notenr</target>
</trans-unit>
It's a valid xml file.
Then I added in the html files this:
<f:translate key='tx_rere_domain_model_note'/>
But in the view there isn't shown anything ... als is blank
what's going wrong?
To switch to other languages you need to include a Navigation that lets you do just that. Language Menus are just a special type of navigation in Typo3.
Look up, what uids your languages are assignes to in the sys_language table - usually 0 is the default, and every language you add gets an entry with a uid incremented by one - so, given 0: english, 1: german, the most basic configuration would look like this:
lib.languages = HMENU
lib.languages {
special = language
special.value = 0,1
}
It's explained more thoroughly in the reference:
http://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Hmenu/Index.html#hmenu-special-property
Remove the extension key. You don't need it as long as your view is inside the same extension. Try this:
<trans-unit id="note">
<source>Note</source>
<target>Note</target>
</trans-unit>
<f:translate key='note'/>
Related
How can I get a translation string in TYPO3 Backend?
In language overview in Backend, I have my custom Content Elements displayed.
If there is no link title set, the button has a language specific default value:
EN: Read more
DE: Mehr erfahren
In Frontend, we have <f:translate, but in Backend this does not work?
Version: TYPO3 V10 LTS
depending on where your label is. the string is defined in TCA (Table Configuration Array) or Flexform. in both cases you use an LLL reference instead of the label
usually somthing like this:
LLL:EXT:my_ext/Resources/Private/Language/backend.xlf:my_label_name
let me pick explain the diffrent parts:
LLL: proccess this aht Local Language resource (similar to http: in an URL)
EXT: this is an Extension Path chheck prefixes like typo3conf/ext/ or typo3/sysext
my_ext/Resources/Private/Language/backend.xlf the path to the file
:my_label_name the label inside the file
<f:translate> does work in the backend as well.
The language file should at least look like:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-08-22T11:22:55Z" product-name="efemtpy">
<header/>
<body>
<trans-unit id="title">
<source>Title</source>
</trans-unit>
</body>
</file>
</xliff>
Maybe you forgot the <source>-Tag like I did before.
I'm using the form extension and that's a part of my yaml file:
-
renderingOptions:
previousButtonLabel: 'Go Back'
nextButtonLabel: 'Send Message'
type: SummaryPage
identifier: summarypage-1
label: Summary
In the xlf file I can access the buttons like this:
<trans-unit id="BasicContactForm.element.page-1.renderingOptions.nextButtonLabel" xml:space="preserve">
<source>Send Message</source>
</trans-unit>
<trans-unit id="BasicContactForm.element.summarypage-1.renderingOptions.previousButtonLabel" xml:space="preserve">
<source>Go Back</source>
</trans-unit>
<trans-unit id="element.BasicContactForm.renderingOptions.submitButtonLabel" xml:space="preserve">
<source>Send Message</source>
</trans-unit>
But how can I access the label (header) of my summary page? This does not seem to work:
<trans-unit id="element.BasicContactForm.summarypage-1.label" xml:space="preserve">
<source>Summary1</source>
</trans-unit>
Neither this:
<trans-unit id="BasicContactForm.element.summarypage-1.label" xml:space="preserve">
<source>Summary1</source>
</trans-unit>
You can translate the labels for (summary) pages the same way as you translate the form field labels.
In your case, the following translations keys are possible:
<!-- All elements of type 'SummaryPage' -->
<trans-unit id="element.SummaryPage.properties.label">
<source>Summary</source>
</trans-unit>
<!-- All elements with the identifier 'summarypage-1' -->
<trans-unit id="element.summarypage-1.properties.label">
<source>Summary</source>
</trans-unit>
<!-- The single element with the identifier 'summarypage-1' inside the form 'BasicContactForm' -->
<trans-unit id="BasicContactForm.element.summarypage-1.properties.label">
<source>Summary</source>
</trans-unit>
I wrote a comprehensive tutorial on TYPO3 form translation with many explanations and examples which you can find here: https://www.sebkln.de/en/tutorials/detail/translating-forms-in-the-typo3-form-framework/
I'm using the Typo3 Formhandler extension to build a simple reaction form. The form works correctly only the error response is in English and not translated. By typoscript I included a languest file.
langFile = fileadmin/templates/sandraverdijck/lang/newsletter.xml
The languest file includes the Dutch translation, see file below.
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<data type="array">
<languageKey index="default" type="array">
<label index="error_sender_name_required">Naam is verplicht</label>
<label index="error_sender_email_required">Email is verplicht</label>
<label index="error_sender_email_email">Email is niet correct ingevult</label>
</languageKey>
</data>
</T3locallang>
The response is still in English like "Your name is missing", I don't know where it gets this from and why it is not using the text from the languest file? When I don't include the languest file I get an error so the file is used. Anyone some idee?
Your language key is default. Is Dutch the default language of the website? Are you setting the language through
config.language = dk
? If so, try using the according language code in the XML file:
<languageKey index="dk" type="array">
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<type>database</type>
<description>Language labels for extension 'dagou_user'</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<!-- Email -->
<label index="email_notify_employer_body"><![CDATA[A new Employer has signed up!<br /><br />Account Name: ###USERNAME###<br />Email: ###EMAIL###<br />Full Name: ###NAME###<br />Company Name: ###COMPANY###<br />Location: ###CITY### ###STATE###, ###ZIP###]]></label>
<label index="email_notify_employer_subject">New Employer</label>
...
</languageKey>
</data>
</T3locallang>
Above code is taken from locallang_dagouuser.xml, meanwhile I am reading this document: http://typo3.org/documentation/document-library/core-documentation/doc_core_api/4.1.0/view/7/2/
Questions:
For type="array", is there any other value I can assign for type? such as type="string"...
<type>database</type>, in the document, it is said "database" : Used for labels of database tables and fields., what does this mean? how could I use these labels with DB tables and fields?
No, there is just this one type.
This is just a hint for the reader what the purpose of this language file is. When you take at look at the TCA of the extension, you will see something like
'label' => 'LLL:EXT:cms/locallang_ttc.xml:sys_language_uid_formlabel'
This is one of the places those language labels for database fields are used.
I am using the Sandcastle Help File Builder and would like to include colorized HTML code snippets in the "Conceptual Content". Is this possible and if so, how?
I have tried <code>, <codeExample>, and <sampleCode language="HTML" />.
The best result so far is to HTML-encode the sample HTML and place it in a .snippets file like so.
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="HTML">
<span>My Html</span>
</sampleCode>
</item>
</examples>
Then reference it in the .aml file.
<codeReference>htmlSnippet</codeReference>
I would prefer to have it colorized, but I can't figure out a way to add the formatting.
According to the MAML Guide, the proper way of doing this is to use a <code> tag with a CDATA section:
<code language="xml" title="Example Configuration">
<![CDATA[
<span>My Html</span>]]>
</code>
The contents of the CDATA section will be treated as a literal string, and indentation will be preserved.
I know this is old, but Sandcastle supports html as xml. I figured I should comment in case anyone else comes across this post as I did.
This should work:
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="xml"><!CDATA[[
<span>My Html</span>
]]>
</sampleCode>
</item>
</examples>
If you're using Sandcastle Help File Builder, you may create your own syntax parser as described here and here, although xml is available by default... using the XAML filter's generator, which is defined here if you want to look at the config:
<generator type="Microsoft.Ddue.Tools.XamlUsageSyntaxGenerator"
assembly="{#SandcastlePath}ProductionTools\SyntaxComponents.dll">
<filter files="{#SandcastlePath}Presentation\Shared\configuration\xamlSyntax.config" />
</generator>
According to the SHFB documentation for the Code Block Component, you should be able to just use the <code>.
I got it to work without a problem; here's what I did:
test.html
<html>
<head>Something!</head>
<body>
<h1>Heading</h1>
<!-- #region myhtml -->
<p>Paragraph</p>
<div>Div for <strong>Good</strong> <em>measure</em>.</div>
<!-- #endregion -->
</body>
</html>
SomethingorOther.aml
<code language="html" source="../Examples/test.html" region="myhtml" />
Result:
Please note that in the preview, your sample will appear as unhighlighted XML, but when you build the documentation, everything should like just fine.