What is the best approach to creating and organizing localized content in Amplience Dynamic Content. Should it be done through a content type (json) or rendering (html, css, .js) or other methods (web hook integrations)
I use multiple repositories one for each language. I put my localised content in each one then create slot type with JSON schema that creates an array of content links that you can point at each local variant. Alternatively you can have an array of content types with a field defined as a locale enumeration and a content link.
e.g.
Slot
--localized content array
----local:en
----content:link to content in en repository
----local:es
----content:link to content in es repository
----local:fr
----content:link to content in fr repository
Example localized slot content type
https://github.com/zestrax/dynamic-content-samples/blob/Development/content-types/slot/localized-slot.json
Use the render service to filter the graph on request e.g.
Create a partial for each country en.HBS which loops through the slot array and return the content matching its locale
you would create a handlebars partial ‘en.hendlebars’ like this to filter the local content in a slot for language 'en'.
{{#each content-list}}
{{#compare locale "==" "en"}}
{{!-- call a partial for to render the locale content --}}
{{>mapping this.content.content-type}}
{{/compare}}
{{/each}}
Related
Is there a way to add custom HTML elements with custom attributes to VS Code so that I will get some autocomplete / intellisense on it?
For example in my framework (here Aurelia) I have added a <my-component is-telling-lies="true" aria-type="hidden" default-target="north">Do you believe?</my-component> and would like to have the element show up when starting to type a new element and inside it the attribute when typing in the attribute space of the element.
Yes, there's a way.
You can extend VS Code's HTML support through a declarative custom data format. By setting html.customData to a list of JSON files following the custom data format, you can enhance VS Code's understanding of new HTML tags, attributes and attribute values. VS Code will then offer language support such as completion & hover information for the provided tags, attributes and attribute values.
See: https://code.visualstudio.com/docs/languages/html#_html-custom-data
You can read more about using custom data in the vscode-custom-data repository.
I was trying to understand how can we make drop-down values in dialog box easily authorable?
Select lists in dialogs can load their options dynamically from anywhere, so long as they are provided as an array of values in JSON format (from the docs):
[
{
value: "pink",
text: "Pink",
qtip: "Real Pink"
}
]
So one solution would be to:
Create a new template that would allow an editor to add/remove values from a list — make this editable for content authors as per any other content (e.g. using the page properties, or components that you can drag onto that template).
Create a Servlet that will parse those values & output them in the expected JSON.
Register that servlet, e.g. via a path (/bin/selectvalues).
Using the cqinclude xtype to load in your values:
i.e.
<select
type="select"
xtype="selection"
options="/bin/selectvalues"/>
If you are looking for a drop-in solution for this, take a look at http://adobe-consulting-services.github.io/acs-aem-commons/features/generic-lists.html. This supports easily authorable lists of name/value pairs which can be used (without writing additional code) in:
Classic UI Dialogs
Touch UI Dialogs
Touch UI Asset Metadata Editor
I am using Play and its templating engine to generate web pages. The content of each page is (partially) stored in an SQL database, either as markup text or as plain HTML. Is it possible to include template snippets (without arguments) within this content?
Here is a small example. Let's say that I have some template #printText() and that this template has been imported at the top of the current view. The following content is stored in the database:
<div>
#printText()
</div>
Is it possible to pass this String to the view and render it properly (including the call to #printText())?
You can easily create for an example static method which will fetch snippet from the database by some key and use it in the view like:
<div id="footer_snippet">
#Html(fetchSnippet("footer"))
</div>
It just should find your snippet in the DB and return the markup HTML as a String
For word report generation, I am looking at binding XML to content controls to see if it is any easier than to use Word Interop and hardcode index reference to content controls to assign values to them.
However, I don't really understand how to do it.
My work flow is entering information in Excel and then generate an XML file to have content controls populated by XML, however, what I read is the other way round: Word Control Control Toolkit and descriptions where the XML is populated by user entering information in Word, and then programmer to unzip docx file to retrieve the XML file.
How can I populate content controls with XML?
There are samples on generating Word documents from Word templates, XML and data bound content controls # http://worddocgenerator.codeplex.com/
Set up the mapped content controls in the 'template' docx using the content control toolkit or similar. Do this using a sample XML file containing your Excel data.
Now you have that template document, at run time you can inject your XML file into it (ie replace the custom xml part it contains, with your instance data), in C# or Java or whatever.
When the user opens the document in Word 2007/2010, the information in the custom XML part will automatically be copied into the bound controls, and visible to the user.
Note that content control data binding doesn't easily support repeating data (eg populating table rows) in Word 2007/2010, though there are ways to do it.
I beginner in zend framework and its a bit hard for me to understand zend_translate how its works.
My Main Question:
How can be done with zend framework translation that will translate each expression according his html id and how non programmer translator can see word location in web browser for translate each expression according his content.
My Sub Questions:
1.How to update additional fields of csv file that holds translation of website?**
2.webpage original word url can not be seen in browser because he sub view that appear in parent form etc
If i have mistakes or you have better solution etc.. please write it.
My targets and partly solutions:
1.Give to non programmer making translation - I choose csv file.
2.Translate separately each word/expression according her appearance context on page and element id- I add columns webpage url and html id to csv file.
(But I have problem that sometimes webpage url can not be seen in browser because he sub view that appear in parent form etc..)
Example1:
view.phtml
........<div id="view-error"><?php translate("error was produced by empty") ?></div>....
......<div id="view-user-firstname"><?php translate("First Name") ?></div>....
My Implementation plan without zend code (I don't know how to do that with zend):
csv files columns names:
1.original word - original word that taking from the page to translate
<?php echo translate($original_word) ?>
2.spain/sweden translation - translation of original word
3.webpage url- webpage link to word translation location
(For translator important to know the location of word to check in which context she used)
4.html id - the id of html div/span/etc.. of translated word
||original word || spain translation ||sweden translation || webpage url || html id ||
Thanks
A regular practice is to have a separate file for each context.
For example each module can have its own translation source file
if you have modules like
modules/user
modules/categories
modules/products
modules/checkout
then you can create appropriate file for each module with all the phrases needs to be translated.
user.cvs
categories.cvs
products.cvs
checkout.cvs
It is not recommended to use URL because in most cases same phrases are used on many pages inside one specific module. So its better to provide a set of screenshots for translator of each page from the specific module.