Generate po or xml file for language translation - expressionengine

I just need a clearance from expert. I need to translate whole site in other language. My site is consist of the 100 of articles. I need to get that whole article translated. Should I create .po or xml file for each article
If above is only way then let me know efficient way to create .po and xml files as these are not small messages.

I see you've tagged your post with 'expressionengine', so I'm assuming that your site is built on EE. In which case, neither .po files nor XML files are the way to go. Since EE offers completely customizable fields and channels, you can have you secondary language content managed just like your primary language content.
There are many different approaches to this in EE, each with their own pros and cons. This article linked below gives a great overview of the many approaches, and offers many links to additional reading. It's more than one answer on SO can properly cover.
Multi-language Solutions for ExpressionEngine on EE Insider

To export as XML:
http://devot-ee.com/add-ons/export-it
or
http://devot-ee.com/add-ons/ajw-export
Alternatively you can simply build a template that outputs the XML using standard {exp:channel:entries} tag pair, making the template type XML and adding the correct header and code for XML.
To re-import:
http://devot-ee.com/add-ons/datagrab
All of the above will involve knowing what fields you want to export out along with their table and row references so it can easily be re-imported.
Strongly suggest you thoroughly test the export and import facility you opt for to ensure it works before beginning any translation process.
Example XML Template (this is to build sitemap.xml but gives you a start on building your own XML structure):
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
{exp:channel:entries channel="pages" entry_id="not 117|104" limit="500" disable="member_data|pagination|trackbacks" rdf="off" dynamic="no" status="Open" sort="asc"}
<url>
<loc>{page_url}</loc>
<lastmod>{gmt_edit_date format='%Y-%m-%dT%H:%i:%s%Q'}</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
{/exp:channel:entries}
</urlset>

Related

Where can I find documentation about generating CMS pages as demo data in Shopware 6?

I am trying to implement custom demo data that is generated once the plugin is activated (similar to the Shopware plugin SwagPlatformDemoData). Part of this demo data are generated CMS pages, although I cannot find any documentation online outlining different methods of generating these pages. The only reference I could find was the 'startseite' cms page generated within the SwagPlatformDemoData plugin (which generates a image on a full-width section, whereas I need to generate text in a main section and a sidebar)
Where would I find documentation for this so that I can implement this further?
I suggest you take a look at the DemodataCommand. It utilizes the DemodataService which uses entity specific generators, implementations of DemodataGeneratorInterface, e.g. the CustomerGenerator. You can register your own generator by tagging it accordingly:
<service id="MyPlugin\Core\Framework\Demodata\Generator\CmsPageGenerator">
<!-- all the services you need -->
<tag name="shopware.demodata_generator" option-name="cms-pages" option-default="60"/>
</service>
Then you should be able to just replicate what the DemotdataCommand does, calling the DemodataService to create data using your own generator.
Regarding the creation of fleshed out CMS pages with random content you may want to look at the CreatePageCommand which creates pages that are to some degree randomized.
You can create a lifecycle and define what need to be installed/removed when (de)activating the plugin. Documentation can be found here: https://developer.shopware.com/docs/guides/plugins/plugins/plugin-fundamentals/plugin-lifecycle#overview
After you've created the lifecycle, you need to create a function and add your content to $this->cmsPageRepository->create($cmsPage, $context);
You can use the structure explained in this documentation: https://developer.shopware.com/docs/concepts/commerce/core/shopping-experiences-cms#structure

Semantically correct way to add a copyright notice into a svg file?

I want to add a copyright notice in my svg files and it should be only "hidden" text and no watermark.
This is no real protection, because if you open a svg file with a text editor you can edit everything and delete the copyright. But I think this would be a simple and great way to show, who has made the file and a possible chance to find unlicensed graphics if there is some hidden information and if you are looking for it you can easily find it.
My main question is: how should the copyright text be put into the file?
<title> element is for accessibility purposes, some user agents display the title element as a tooltip.
<desc> element generally improves accessibility and you should describe what a user would see.
ugly way: a text element with inline CSS to hide it. Don't even think about this! :)
<!--Copyright info here--> could be also a simple solution.
<metadata>: this would the best way but I did not find a detailed definition and which child elements could live inside. Also https://developer.mozilla.org/en-US/DOM/SVGMetadataElement gives a 404.
Under https://www.w3.org/TR/SVG/struct.html#MetadataElement we can find more details. But is RDF really necessary?
I think a <metadata> element is the right place, but which child elements should be used and is just RDF the way to go?
I think the metadata element is the correct choice here. It has to contain XML, but it doesn’t have to be a RDF serialization (e.g., RDF/XML).
But I think it makes sense to use RDF here, because that’s exactly RDF’s job (providing metadata about resources, like SVG documents), and there is probably no other XML-based metadata language that has greater reach / better support.
A simple RDF statement (in RDF/XML) could look like this:
<metadata>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:schema="http://schema.org/">
<rdf:Description rdf:about="http://example.com/my-svg-file.svg">
<schema:license rdf:resource="https://creativecommons.org/licenses/by-sa/4.0/"/>
</rdf:Description>
</rdf:RDF>
</metadata>
The about attribute takes an IRI as value; for a stand-alone SVG document, you could provide an empty value (= the base IRI of the document).
In this example I use the license property from Schema.org:
A license document that applies to this content, typically indicated by URL.
(The vocabulary Schema.org is supported by several big search engines.)

Use liferay-ui:asset-categories-selector tag to offer one vocabulary only

I'm developing a Liferay portlet supposed to offer a way of categorizing its content. I created multiple vocabularies (e.g. frogs, apes, birds).
In the view of THIS portlet I want to offer the categories of the "frogs"-vocabulary only. I know I could write some code to read the categories contained in the vocabulary to offer them in a combo-box.
But, isn't there a way of convincing the built-in liferay-ui:asset-categories-selector-tag to show one vocabulary only? Or may be there's some other tag? (I'm stuck here.)
Here's my current code that lists all vocabularies:
<liferay-ui:asset-categories-selector
className=" <%= JournalArticle.class.getName() %>"
/>
Unfortunately this taglib's documentation is quite tumbleweed. You might need to look into the implementation for the actual content of the attribute, but curCategoryIds might be a good choice to start trying out if this is foreseen.
Alternatively it might be worth creating another tag (based on this one, in a new taglib) - if you do this, you might want to file an issue or feature request and contribute it back into the liferay-ui taglib.

Gate- add annotation to entire document

I am trying to do document classification with gate. For that I need to annotate the entire document with one type of annotation. Can anyone please tell me how to do that?
Usually I use XML for that purpose. Something like:
<document class="class-1">
The text of you document 1 is here..
</document>
<document class="class-2">
The text of you document 2 is here..
</document>
Then save these xml as separated files (or as one document).
In GATE application you can use Annotation Set Transfer PR and move annotation from "Original markups" to default annotation set. This is one of the options. Other options depends on data format you have.
If your source documents are HTML or XML then there will already be an annotation in the Original markups set that spans all the content, otherwise the simplest option would be to load the Groovy plugin and use the scripting PR with a one-line script like
outputAS.add(doc.start(), doc.end(), "Document", Utils.featureMap())

All mandatory field in a xsd file?

Is there a quick way to find out all the mandatory field in a xsd file?
I need to quickly see all the mandatory fields in the schema
thanks
Not sure if you're looking to do this through code. If not, Altova XMLSpy, for example, provides an option to "Generate Sample XML File" - with options to generate only mandatory fields.
Otherwise, if you're working with Java, for example, you can use something like the Eclipse XSD project for programmatic access to the XSD. (It even works without Eclipse.) Some additional details at Are there any other frameworks that parse XSD other than XSOM? .
Take a look at this post; instead of exporting all fields, there's also an option to get only the mandatory ones... One significant difference compared with the answer you accepted is in that you can also generate an Excel or CSV file, in addition to the XML file; not to mention that the sample XML approach is deficient by definition... I would pay attention to the way mandatory choices, abstract typed elements or abstract elements with substitution groups play in your case.

Resources