Cant render an outputText depending on my systemLocal Variable - oracle-adf

I have a page template that in webcenter portal with footer with 2 output text which will be rendered depending on the selected language from the language task flow.
I have custom template which I've created with the jdeveloper
and had put the follwing output label:
<af:outputFormatted id ="copyright" rendered="# {facesContext.externalContext.requestLocale} eq 'en'" value="the english text" />
<af:outputFormatted id ="copyright" rendered="#{facesContext.externalContext.requestLocale} eq 'ar'" value="the arabic text" />
And this El expression always return false
so how to render this components depending on the selected language?

The issue is that you are closing your el expression too soon ("requestLocale }") . To fix it, replace :
<af:outputFormatted id="copyright" rendered="#{facesContext.externalContext.requestLocale} eq 'en'" value="the english text" />
by
<af:outputFormatted id="copyright" rendered="#{facesContext.externalContext.requestLocale eq 'en'}" value="the english text" />
Or, as an alternative solution, you can have only one outputFormatted with all values like this :
<af:outputFormatted id="copyright" value="#{facesContext.externalContext.requestLocale eq 'en' ? 'the english text':(facesContext.externalContext.requestLocale eq 'ar' ? 'the arabic text' : 'Default text')}" />
However if you are looking for a translation functionnality in ADF you should go for a translation bundle file as explain in the documentation here : https://docs.oracle.com/cd/E15051_01/web.1111/b31973/af_global.htm#ADFUI425
Internationalization is the process of designing and developing products for easy adaptation to specific local languages and cultures. Localization is the process of adapting a product for a specific local language or culture by translating text and adding locale-specific components. A successfully localized application will appear to have been developed within the local culture. JDeveloper supports easy localization of ADF Faces components using the abstract class java.util.ResourceBundle to provide locale-specific resources.
When your application will be viewed by users in more than one
country, you can configure your JSF page or application to use
different locales so that it displays the correct language for the
language setting of a user's browser. For example, if you know your
page will be viewed in Italy, you can localize your page so that when
a user's browser is set to use the Italian language, text strings in
the browser page will appear in Italian.
ADF Faces components may include text that is part of the component,
for example the af:table component uses the resource string
af_table.LABEL_FETCHING for the message text that is displayed in the
browser while the table is fetching data during the initial load of
data or while the table is being scrolled. JDeveloper provides
automatic translation of these text resources into 28 languages. These
text resources are referenced in a resource bundle. If you set the
browser to use the language in Italy, any text contained within the
components will automatically be displayed in Italian. For more
information on skins and resource bundles, see Chapter 20,
"Customizing the Appearance Using Styles and Skins".
For any text you add to a component, for example if you define the
label of an af:commandButton component by setting the text attribute,
you must provide a resource bundle that holds the actual text, create
a version of the resource bundle for each locale, and add a
element to define default and support locales in the
application's faces-config.xml file. You must also add a
element to your application's faces-config.xml file
in order to make the resource bundles available to all the pages in
your application. Once you have configured and registered a resource
bundle, the Expression Language (EL) editor will display the key from
the bundle, making it easier to reference the bundle in application
pages.
To simplify the process of creating text resources for text you add to
ADF components, JDeveloper supports automatic resource bundle
synchronization for any translatable string in the visual editor. When
you edit components directly in the visual editor or in the Property
Inspector, text resources are automatically created in the base
resource bundle.

Related

Create Landing Page in Drupal 7

In Drupal one can basically style the elements, like the search box, or the basic page etc. and then put some content in the site and the resulting page will be generated. But what if you want one specific site (e.g. the index page) to be different? E.g. have a image as a background, a different navigation styling etc.
What's the best paractice way of doing this?
Best practice is to have a different theme which you can switch to by using hook_custom_theme() where you check the current path. Also make sure that your theme to switch to is enabled:
/**
* Implements hook_custom_theme().
*/
function YOUR_MODULE_custom_theme() {
# check path with arg(0)
# return theme name to switch to
return 'different_theme_machine_name';
}
Alternatively you can also try ThemeKey doing this out of the box with an interface & allowing you the specify rules.
If you need to change only the content(body) section of your page, use Disply Suite. You can create unique look and feel layouts for your body section of each page.
If you trying to change the complete layout of one page (eg: Services), Create new Content Type 'Services'. Then create a template file for this content type, You must name this template call page--services.tpl.php. And also you can overwrite the index page layout by creating page--front.tpl.php template. Done!
What you are saying you want to change is all styling. And you know you can do a page to look drastically different with CSS... and you can do it that way depending on your chosen Drupal theme.
Now, with the Chrome Inspector (or FF inspector) look at the body tag, it probably has many classes which indicates in what page you are, what type of node (if it's a node) or if it's an admin section, or an anonymous user.
Using those specific classes you can style a frontpage, or a view, or a node, or anything, without installing more modules... with some limitations because you can't change rendered HTML this way.
Finally, don't get scared by using modules in Drupal, it's how Drupal works and it works pretty well. The thing is to install the best tools to increase your productivity, and Drupal have excellent options to change your theming and content like Display Suite (like #BaikHo suggested).
Hope that helps.
PD: Using the less module and with custom your theme you can have LESS css which is considerably faster than using only CSS, and because it's integrated with Drupal you can theme make everything even faster. Give it a try.

Change default content type for previewing site with "nanoc view"

I generate HTML files without any filetype extension with the following route in nanoc’s Rules file:
route '/blog/*/' do
item.identifier.chop
end
So the file /content/blog/hello-world.html gets generated as /output/blog/hello-world, leading to the URL path /blog/hello-world.
When using nanoc’s built-in preview server (nanoc view, which uses adsf and WEBrick, as far as I understand), these extension-less HTML files get interpreted as plain text.
For previewing with nanoc view, how can I set the default content type (i.e. text/html) for files without filetype extensions?
(When publishing this site, I set the correct content type in Apache’s .htaccess file so that the files get interpreted as HTML, but WEBrick/adsf don’t seem to support .htaccess.)
You should be writing those to /output/blog/hello-world/index.html instead. That makes them work seamlessly in nanoc view, Apache (with no .htaccess), even by just opening the site files in your browser (assuming you're using relativized links).

Is it possible for an entry to have two URL in Expression Engine, and translate template names?

I'm currently making a bilingual Expression Engine 2.5.2 website. I'm using this technique to create the two langues, which works perfectly.
I have created a {country_code} global variable in the two index.php files which allows me to detect the current language.
Using this technique, I have no problems to get language-relative data when accessing an entry. My only concern is that I apparently have to privilege a language-specific "clean" URL.
Example entry:
{entry_id} = 123
{title} = My test article
{title_permalink} = my-test-article
{name_fr} = Mon article
{name_en} = My article
If I request http://www.example.com/index.php/en/blog/articles/my-test-article, I expect to to find, in english, "My article" using the template articles in the blog template group.
Everything is fine, but the french translation is accessible when requesting http://www.example.com/index.php/fr/blog/articles/my-test-article. The correct translation of the URL should be http://www.example.com/index.php/fr/blogue/articles/mon-article-test.
Anyone encountered a problem like this? Any solutions via extensions or modules?
I believe the Transcribe module solves this by both providing the ability to translate template group and template names, and having you create a separate entry for each language and piece of content in your site (hence, you have two separate URL titles). But that means buying into their entire methodology for a multi-lingual site.
Myself, I usually just stick to using the entry_id instead of the url_title, and live with the template names being in the primary language.
The best way I found to achieve this is by embedding templates with segment translations, duplicating template groups and duplicating channels.
In the blog/articles template:
{embed="shared/.head" segment_2_translation="blogue" segment_3_translation="articles"}
In the blogue/articles template:
{embed="shared/.head" segment_2_translation="blog" segment_3_translation="articles"}
In shared/.head template:
[...] {if lang == "fr"}English{if:else}Français{/if} [...]
And then you can create a Articles (FR) and a Articles (EN) channels, and each will have their unique URL titles. You can also add a relationship custom field for each channel to associate an entry with it's translation.
It feels messy, but it is the only way I could make it work without modules, plugins or whatnot.

How can I easily export content from Sitecore 6?

I need to find a simple way to export Sitecore 6 content to a file for translation. I tried using Control Panel | Globalization | Export Languages to a File. However I get odd results. For some reason it seems like it is only exporting the __Source field and no other fields. So the XML file that I get back isn't very helpful - it doesn't include all of the fields in the content item.
Does anyone know how I can either get the Export Languages feature to work properly or if there is some other easy way to export content from Sitecore 6?
To serialize the content item
Navigate to the item in the Content Editor
Select the "Developer" tab at the top
Hit "Serialize Item" in the "Serialize" chunk
Navigate to your /data/serialization/itempath such as... "/data/serialization/master/sitecore/content/home.item"
There's your file
Now that you've made edits to the file for localization
Overwrite the file in serialization step #4 with new copy
Navigate to the item in the Content Editor
Select the "Developer" tab at the top
Hit "Update Item" in the "Serialize" chunk
You're all done
You can fully export a database using the serialization admin tool at http://yoursite.com/sitecore/admin/serialization.aspx

Sitecore country ISO in url

I have created a site with multiple languages in sitecore... I the content editor (system > languages) I have specified three languages (Dutch, English and German). No I have 2 problems.
When an item has, for example: an English version but no German and Dutch version and I type the address to the German site: www.testsite.com/de I get the German site, but without content. In this case I want a 404 page to be shown.
Another problem is when I go to language that is not specified in system > language and also on the item is still get an empty site. In this case I also want a 404 page to be shown. Sitecore shows the page as long as it is a valid ISO-code.
I'm using Sitecore 6.4
Does anybody has a solution for these problem(s)?
Thanks in advance!
mrtentje
My LinkManager is specified as follows in the Web.config:
<add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="true" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" shortenUrls="true" useDisplayName="false"/>
Unfortunately you have to manage both of these scenarios manually in Sitecore, they both have quite simple solutions but will require some development on your part.
For the first (accessing of pages without translations) I think you would need to extend the current ItemResolver within Sitecore and have it explicitly check that a version exists for the language that has been selected. I haven't implemented that myself but that's how I'd look at handling it.
The second (only accepting certain languages) is something I have handled, and it really bothered me that Sitecore couldn't handle it itself (though perhaps it does and I missed it). For this I created a step in the pipeline immediately after the LanguageResolver called PermissableLanguageChecker. This checks to see if the current language of the request is one of certain allowable values, and if it isn't it sets the language back to the default language, or in your case throw a 404.
For the "allowable values", I read them from the site config with a new property there:
<site name="website" ... permissableLanguages="pl-PL,en" language="pl-PL" ... />
That permissableLanguages property is handy as we can also use it later on in the site when presenting a language selection control to the user.
You may want to take a look at the Language Fallback module in the Sitecore Shared Source Library. As it covers some of your scenarios.
http://trac.sitecore.net/LanguageFallback

Resources