Add translation to TYPO3 Extension via Typoscript - localization

is there a way to substitute/override the default de.locallang.xlf of the extension via Typoscript? I want to change the text of mindshape_cookie_hint in a way that will survive an update.

If it is a plugin you can override translations in TypoScript via _LOCAL_LANG which is also what mindshape_cookie_hint suggests in its docs, for example:
plugin.tx_myext_pi1._LOCAL_LANG.de.list_mode_1 = Der erste Modus
This requires you to manage your translation strings in TypoScript though which is far from ideal.
A better and more general solution is registering custom translations via locallangXMLOverride. This allows you to manage these translations just like everywhere else.
From the documentation:
ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:cms/locallang_tca.xlf'][] =
'EXT:examples/Resources/Private/Language/custom.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']
['de']['EXT:news/Resources/Private/Language/locallang_modadministration.xlf'][] = 'EXT:examples/Resources/Private/Language/Overrides/de.locallang_modadministration.xlf';
The first line shows how to override a file in the default language, the second how to override a German ("de") translation. The German language file looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-03-09T18:44:59Z" product-name="examples">
<header/>
<body>
<trans-unit id="pages.title_formlabel" xml:space="preserve">
<source>Most important tile</source>
<target>Wichtigster Titel</target>
</trans-unit>
</body>
</file>
</xliff>

You are looking for this https://wiki.typo3.org/TypoScript_language_additions,_override
As written by Ghanshyam Bhava in his answer, you can just take a look at
the locallang.xlf file in the plugin folder in the file system to have an overview of the keys the extension uses and then write in your TypoScript template:
plugin.tx_exampleplugin_pi1._LOCAL_LANG.it {
key1 = value1
key2 = value2
...
}
see also https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Plugin/Index.html#local-lang-lang-key-label-key
In a general way, correct me if I am wrong, I think that you have modified the original .xlf file of the plugin; this procedure is not recommended for the reason you are facing: an update would delete your changes.
A good way to deal with this problem could be for example using the extension EXT:lfeditor (https://extensions.typo3.org/extension/lfeditor/); read carefully its manual.
Another source (official documentation): https://docs.typo3.org/typo3cms/CoreApiReference/latest/ApiOverview/Internationalization/ManagingTranslations.html?highlight=locallangxmloverride#custom-translations
I'll take an excerpt from that page:
The $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] allows to override both locallang-XML and XLIFF files. Actually this is not just about translations. Default language files can also be overridden. In the case of XLIFF files, the syntax is as follows (to be placed in an extension's ext_localconf.php file):
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:cms/locallang_tca.xlf'][] = 'EXT:examples/Resources/Private/Language/custom.xlf';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['de']['EXT:news/Resources/Private/Language/locallang_modadministration.xlf'][] = 'EXT:examples/Resources/Private/Language/Overrides/de.locallang_modadministration.xlf';
The first line shows how to override a file in the default language, the second how to override a German ("de") translation. The German language file looks like this:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-03-09T18:44:59Z" product-name="examples">
<header/>
<body>
<trans-unit id="pages.title_formlabel" xml:space="preserve">
<source>Most important tile</source>
<target>Wichtigster Titel</target>
</trans-unit>
</body>
</file>
</xliff>

With below typoscript you can overwrite individual translations for TYPO3 Extension:
plugin.tx_myPlugin_pi1._LOCAL_LANG.de.key = value;
plugin.tx_myPlugin_pi1._LOCAL_LANG.en.key = value;
Generally common for every extension. Hope this will help you!
Greetings!

Related

Teiid User Defined Java Functions not visible

I am using teiid-wildfly servers. I followed the user defined functions example provided in teiid documentation. Below is my vdb file. Please let me know if I need to import any additional properties to view/access user defined functions. Metadata URL(http://localhost:8080/odata4/UDFTest/JavaCall/$metadata) does not list user defined function and no error in the server log. I created jar file which contains TempConv file implementation and completed the setup under module directory.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="UDFTest" version="1">
<property name ="lib" value ="org.test"></property>
<model visible="true" name="JavaCall" type="VIRTUAL">
<metadata type="DDL">
<![CDATA[
CREATE VIRTUAL FUNCTION celsiusToFahrenheit(celsius double) RETURNS double OPTIONS (JAVA_CLASS 'org.test.TempConv', JAVA_METHOD 'celsiusToFahrenheit');
]]> </metadata>
</model>
</vdb>
OData has a known issue with exposing functions: see https://issues.redhat.com/browse/TEIID-5736
The workaround would be to use a procedure instead.

Ant xmlproperty task fails due to validation error

I want to extract an application version from a DITA map file. The ditamap file is valid and looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="user-manual">
<title><ph keyref="product"/> User Manual</title>
<topicmeta>
<prodinfo>
<prodname><keyword keyref="product"/></prodname>
<vrmlist>
<vrm version="4" release="3" modification="0"/>
</vrmlist>
</prodinfo>
</topicmeta>
<!--
[...]
-->
</map>
The information I want to get is in the <vrm> element.
"Easy peasy," I think to myself. So I use Ant's <xmlproperty> task to just load this XML file.
<project default="test">
<!-- notice #validate -->
<xmlproperty file="path/to/user-manual.ditamap" validate="false"/>
<target name="test">
<echo>${map.topicmeta.prodinfo.vrmlist.vrm(version)}</echo>
</target>
</project>
I don't want it to validate because Ant isn't going to find map.dtd.
Loading the file returns an error:
java.io.FileNotFoundException: /home/user/user-manual/map.dtd (No such file or directory)
If I remove the <!DOCTYPE> declaration or add a nested <xmlcatalog> with the path to the DTD, the file loads and I can use the properties from it.
I tested this with Ant 1.7.1 and 1.9.4. Is this a bug with Ant, or am I misunderstanding how Ant loads XML properties and the purpose of the validate attribute?
How can I make Ant obey my will?
I recommend to not use the <xmlproperty> for this. Please have a look at the docs:
For example, with semantic attribute processing enabled, this XML
property file:
<root>
<properties>
<foo location="bar"/>
<quux>${root.properties.foo}</quux>
</properties>
</root>
is roughly equivalent to the following fragments in a build.xml file:
<property name="root.properties.foo" location="bar"/>
<property name="root.properties.quux" value="${root.properties.foo}"/>
So the name of the properties you set is generated using their paths to the root element, so they rely on the structure of your DITA Map. But many elements in DITA may be set at different positions on your DITA Map. That means, if you move your metadata to another parent element, the property name changes and your build fails. This is probably not, what you want.
I'd recommend to grab those values via XSLT and than set the properties. That way, you could, for example, say, "give me the first occurance of that element with a simple //foo[1] XPath selector. Further on, you have the power of XSLT and XPath to slice values, format dates and so on before setting a property.
Update
You can use the oops consultancy Ant xmltask for that. It is very easy to set a property using <copy>:
<copy path="//critdates/created/#date"
property="document.date"
append="false"/>

How to extend felogin's locallang?

How is it possible to add translations of strings to the felogin plugin? I slowly start to get the convention for templates (directing to the modified templates in the plugin's typoscript configuration) but that does not work with the locallang. The original messages are in English in the xlf format, located in the plugin's folder. I know this can be done in TypoScript but I do not like to have the strings defined so incosistently. (I guess modifying that original file is not the proper way.)
Overriding labels by TypoScript is the way to go. Manually editing the l10n files is a really bad idea - these files are overwritten on updating the translations. If the extension gets an update and new labels are added, you will want to perform the updates.
The change from XML files for translation to the XLIFF format didn't change anything in the best practise you should use for adjusting labels according to your needs. It's just another format with a standardized translation server (Pootle) that (in theory) allows some special features like e.g. plural forms.
Conclusion: Use TypoScript.
For the default language (no config.language set) use:
plugin.tx_felogin_pi1._LOCAL_LANG.default {
key = value
}
For a specific language, e.g. German, use
plugin.tx_felogin_pi1._LOCAL_LANG.de {
key = value
}
The best way is to use the following code:
ext_tables.php, e.g. of your theme extension with
$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:felogin/Resources/Private/Language/locallang.xlf'][] = 'EXT:theme/Resources/Private/Language/locallang_felogin.xlf';
and in this file you can use something like
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2015-06-30T21:14:27Z">
<header>
<description>Language labels for felogin</description>
</header>
<body>
<trans-unit id="permalogin">
<source>An diesem Rechner angemeldet bleiben</source>
</trans-unit>
<trans-unit id="ll_forgot_header">
<source>Passwort vergessen?</source>
</trans-unit>
<trans-unit id="ll_welcome_header">
<source>Sie betreten den Händlerbereich</source>
</trans-unit>
<trans-unit id="ll_welcome_message">
<source>Bitte loggen Sie sich ein.</source>
</trans-unit>
</body>
</file>
</xliff>
You can use the BE language module to download preconfigured locallangs for every language you need.
The files are stored in e.g. typo3conf/l10n/de/fe_login.
You can edit these files manually in l10n to get your own strings inside or use an extension like snowbabal to do the editing inside a BE module.

How to work with AndroidManifest and Assembly

Base on Xamarin Studio instruction, I follow it to create the AndroidManifest which looks as below.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1"
android:versionName="1.0"
package="HelloMultiScreen.HelloMultiScreen">
<uses-sdk />
<application android:label="HelloMultiScreen">
<application>
<manifest>
I have these questions:
1) How come it DOES NOT list out all the control or widget like the google manifest?
2) Do I need to edit it whenever I add additional control or widget like textView ?
3) Do I need to care about the order of the control or widget of which I add first or later?
4) Do I need to manually add the below or it is self generated?
[assembly: UsesPermission(Manifest.Permission.AccessFineLocation)]
[assembly: UsesPermission(Manifest.Permission.AccessCoarseLocation)]
thanks
Quite a lot of your questions are answered in this page - http://docs.xamarin.com/guides/android/advanced_topics/working_with_androidmanifest.xml
In general, Xamarin auto-generates much of the file for you, using hints in the code like [Activity] attributes.
I recommend you read that document above, experiment a little and then come back here if you have specific questions/problems.

How to get the language specific messages using google closure template

Am trying to implement internationalization support to my project for this people suggested google Closure Templates.but am very new to closure templates.am trying to get the language specific messages using closure template but am not getting in xlf file.If any one knows how to generate language specific messages using closure template, please tell me the steps.that's great help to me.
My .soy file code as bellow.
{namespace poc}
/**
*Testing message translation
*#param pageTitle
*/
{template .translate}
<HTML>
<Head>
<title>{$pageTitle}
</title>
</head>
<div>
{msg desc="Hello"}Hello{/msg}
</div>
</html>
{/template}
and generated .xlf content as bellow
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="SoyMsgBundle" datatype="x-soy-msg-bundle" xml:space="preserve" source-language="en" target-language="pt-BR">
<body>
<trans-unit id="2286494898080570401" datatype="html">
<source>Thanks</source>
<target/>
<note priority="1" from="description">Says thanks</note>
</trans-unit>
</body>
</file>
</xliff>
I see you already used the SoyMsgExtractor to create the base xlf. Next you need to make translations of this base xlf to the languages you want to support. A file for each language is created. I used the xliff exitor from Translution. http://sourceforge.net/projects/eviltrans.
Next, using the SoyToJsSrcCompiler a translation soy can be made per language:
java -jar SoyToJsSrcCompiler.jar --shouldGenerateGoogMsgDefs --bidiGlobalDir 1 --messageFilePathFormat Filename_en-us.xliff --outputPathFormat FileName_fr.js *.soy
This will create a Filename._fr.js file that contains the compiled soy file.
Including this file instead of the original soy (or compiled) will create a localized version.
Good luck!
\Rene
i think the easiest way is to make (i.e. generate from whatever source) a separate js file which contains one messages object and reference it through an extern declared function.
it justs works and has no complicated dependencies.

Resources