Joomla component for multiple language - joomla

In one of my multi language website, there is a custom component. In which we can create "CategorY" and products under category.
It has been implemented in the backend and front end and its working fine in english.
But my client need same component in the "arabic" ( which is my second language). Is there any simple way to do this. Now in arabic session also "english" is showing.
Best of my knowledge, We can take 2 inputs from the backend. like title_english, title_arabic and show accordingly. So my table looks like
id | title_arabic | english_title
------+----------------------+----------------------
1 | title in arabic | English title
------+----------------------+----------------------
2 | title in arabic | English title
------+----------------------+----------------------
3 | title in arabic | English title
------+----------------------+----------------------
4 | title in arabic | English title
------+----------------------+----------------------
5 | title in arabic | English title
------+----------------------+----------------------
6 | title in arabic | English title
------+----------------------+----------------------
My question is is there any wat to differentiate the language in the front end and show the title accordingly ? something like
if($language=="english")
echo $item->english_title;
else
echo $item->title_arabic;
Please help
Thanks for advance

You can find it in the below URLs
http://multilingual-joomla-demo.cloudaccess.net/
http://docs.joomla.org/Adding_multi-language_support
http://cool-tricks.net/create-a-joomla-multilanguage-website/
http://www.scribd.com/doc/82768844/Joomla-2-5-multi-language-website-without-using-3rd-extensions-in-10-steps

Related

xpath all HTML tags <a> in body except in <footer> limited to x

I need to find all HTML tags a in the body except those from footer and limit them to a certain value.
Without any limitation, I have found this :
//body | //a[not(ancestor::footer)]
Not sure it is correct though.
With the limitation :
//body | //a[not(ancestor::footer)]/a[position()<=25]
But this not work
Or :
//body | //a[not(ancestor::footer)] | /a[position()<=25]
But it does not limit anything
What would be the correct syntax to combine conditions ?
AFAIK you should not use | there.
Without the amount limitation your XPath could be
//body//a[not(ancestor::footer)]
While with the limitation of output to 25 results only your XPath will be
//body//a[not(ancestor::footer) and position()<=25]

Is there a way in Jekyll to retrieve the number of pictures in a post's content?

In a Jekyll's post I've seen how to count words with include.content | number_of_words but I was wondering if there was a way to count pictures in the content?
I do know there is a way to get a featured image if I add it to the frontmatter like:
feature-img: "img/foobar.png"
Per my searches I did see post.layout but I am unable to find if there is a way to get the count of images in a post's content. When I search to see if this has been asked or someone has brought this up in Jekyll issues the only I do not get any results but I have read:
Is there a way to access rendered content in Jekyll?
How to retrieve the current post index number in Jekyll?
How to include all files in a folder in Jekyll?
I could see if I was going to build a gallery for a post adding the images to the frontmatter like:
---
layout: post
title: "This is a title"
images:
- url: "img/foo.png"
alt: "Enter the foo"
title: "apart of foo"
- url: "img/bar.png"
alt: "Enter the bar"
title: "apart of bar"
---
but the images are spread throughout the content. I guess I could hard code it to every post in the frontmatter like:
---
image-count: 4
---
but I think that just bloats the frontmatter. In Jekyll is there a way to get the post's images count dynamically?
You can probably split the content, like this:
{% assign contentparts = content | split: '<img' %}
{% assing amountofimages = contentparts | minus:1 %}
Then use:
{{ amountofimages }}
Note that I did not test this.
I've figured out a way to get the count of images in a post without hard coding the image count in the front matter:
{% assign postPics = include.content | split: "<img" | size %}

Spring REST Docs: Non-English character string not working in custom snippet table column

I've defined a custom snippet template for response-fields.adoc to include an additional column where i used Chinese characters for the name of that new column. The problem is that the generated snippet doesn't show the column name in the correct Chinese characters, although the data in the column are showing correctly in Chinese.
My response-fields.snippet file is encoded in UTF-8.
This is my custom snippet template:
|===
|Field|Type|Description|中文描述
{{#fields}}
|{{path}}
|{{type}}
|{{description}}
|{{description_zh_tw}}
{{/fields}}
|===
Expected generated snippet:
|===
|Field|Type|Description|中文描述
|responseStatus
|String
|ID of the team.
|測試
|infected
|String
|ID of the team.
|測試
|fileName
|String
|ID of the team.
|測試
|===
Actual generated snippet:
|===
|Field|Type|Description|銝剜��膩 <==== encoding problem?
|responseStatus
|String
|ID of the team.
|測試
|infected
|String
|ID of the team.
|測試
|fileName
|String
|ID of the team.
|測試
|===
Change the encoding of the snippet template from UTF-8 to Big5 resolves the issues.

What is translations in laravel?

I am new to laravel just working on larapay template i want to know about translations.
Below is my code to create one label and input on form:
<div class="form-group">
{!! Form::label('hsnsac',trans('HSN/SAC').' '.trans('code'),[])!!}
{!! Form::input('number','hsnsac',isset($item) ? $item->hsnsac : '',['class'=>'form-control','placeholder'=>trans('HSN/SAC').' '.trans('messages.code')])!!}
</div>
Below is default code for display elements:
<div class="form-group">
{!! Form::label('code',trans('messages.item').' '.trans('messages.code'),[])!!}
{!! Form::input('text','code',isset($item) ? $item->code : '',['class'=>'form-control','placeholder'=>trans('messages.item').' '.trans('messages.code')])!!}
</div>
i cant understand what is trans(messages) in code.
and if i used my own code like trans(messages.hsnsac) it will display this messages.hsnsac on form.
trans is a shortcut helper to the lang directory in your resources directory.
If your lang is set to en it will attempt to derive from this. Because the notation is dot based, the first word will be the file name, the second will be the key, like this:
resources
|
| ---- lang
|
| ---- en
|
| ---- messages.php
Now you need to return an array fro this file.
return [
'hsnsac' => 'This text will appear now';
];
Finally, if you call trans('messages.hsnsac') it will return This text will appear now.
Mind you, this is only for en. If you are using another language, make sure the file exists in a directory for that lang under resources/lang as well.
You need to define these translation strings.
Create the file resources/lang/{language}/messages.php and add your translations here.

Joomla K2 change pagination titles by adding number of the page to the pagination

Can you tell me how can I add custom title to the pagination title in K2
On all pages (1,2,3 etc.) the title is the same, and I want to add Page1, Page2, etc., so the titles to become like this: title+Page1, title+page2, etc
OK, I found a solution, so hope it will be useful for others too :)
In the file /components/com_k2/views/itemlist/view.html.php
Find Line 196:
// Set title
$title = $category->name;
and change to:
// Set title
$titlesuffix = ' Page #' . (intval($limitstart/$limit)+1);
$title = $category->name . $titlesuffix;
You can use this code for tag pagination, metadescription. Just search the needed lines in the same file
Until this is sorted permanently by being part of the code (as it makes sense), here's a cleaner solution that does not require changing core K2 code: https://github.com/getk2/k2/issues/539

Resources