jDiction Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

jDiction 2.2.0 released. http://jdiction.org/downloads

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - jstead

Pages: [1] 2
1
General Questions / Re: Alternate Meta Tags
« on: December 01, 2014, 11:35:09 pm »
Hi Harald,

Works perfectly!
This method is great, as it also gives the user control over which language is the default as its based of the "Language Manager > Content" ordering.

If I moved French Canadian above French in the Language Manager -> content ordering, it switched which got the 2 digit or 4 digit ISO, so this is perfect as different users would have different defaults.
Couldn't test what would happen if there were 3 variations of the same language, but assume anything after the first instance would get the 4 digit ISO as well.

Kind Regards,
Jason

2
General Questions / Re: Alternate Meta Tags
« on: November 27, 2014, 01:18:40 am »
Hi Harald,

I have finally been able to test this new version, and it is correctly displays all languages (including current) and also toggles between 2 digit and 4 digit code.
Code: [Select]
  <link href="/en/" rel="alternate" type="text/html" hreflang="en-GB" lang="en-GB" title="Home" />
  <link href="/us/" rel="alternate" type="text/html" hreflang="en-US" lang="en-US" title="Home" />
  <link href="/de/" rel="alternate" type="text/html" hreflang="de" lang="de-DE" title="Startseite" />
  <link href="/fr/" rel="alternate" type="text/html" hreflang="fr-FR" lang="fr-FR" title="Accueil" />
  <link href="/ca/" rel="alternate" type="text/html" hreflang="fr-CA" lang="fr-CA" title="Accueil" />
  <link href="/it/" rel="alternate" type="text/html" hreflang="it" lang="it-IT" title="Pagina iniziale" />
  <link href="/es/" rel="alternate" type="text/html" hreflang="es" lang="es-ES" title="Inicio" />
  <link href="/ru/" rel="alternate" type="text/html" hreflang="ru" lang="ru-RU" title="Главная" />
  <link href="/cn/" rel="alternate" type="text/html" hreflang="zh" lang="zh-CN" title="起始界面" />

The only issue is now thou, is that not all duplicate languages would need to be 4 digits. You still need at least 1 entry from each language to be purely language (2 digit) and which one this is, could differ from user to user.

For instance in the above, the 2 English entries are United States and Great Britain country targeted. Where having
Code: [Select]
  <link href="/en/" rel="alternate" type="text/html" hreflang="en" lang="en-GB" title="Home" />
  <link href="/us/" rel="alternate" type="text/html" hreflang="en-US" lang="en-US" title="Home" />
would target the en-US spelling to United States, but the en-UK spelling to anyone else that has their system set to English regardless of country.


Not sure how this could be maintained outside of manually changing it like I did in the version prior to this (code I used below).
Code: [Select]
} else {
$lang->active = false;
if (($lang->menutitle != '') && ($params->get('alternatetag'))) {
if ($lang->lang_code == 'en-US' || $lang->lang_code == 'fr-CA' ) {
$doc->addHeadLink($lang->link, 'alternate', 'rel', array(
'type' => 'text/html',
'hreflang' => $lang->lang_code,
'lang' => $lang->lang_code,
'title' => $lang->menutitle
));
} else {
$doc->addHeadLink($lang->link, 'alternate', 'rel', array(
'type' => 'text/html',
'hreflang' => substr($lang->lang_code, 0, 2),
'lang' => $lang->lang_code,
'title' => $lang->menutitle
));
}
}
}

Let me know if there is another aspect of it you would like me to test.

Kind Regards,
Jason

3
General Questions / Re: Alternate Meta Tags
« on: November 24, 2014, 07:19:59 am »
Hi Harald,

Thank you for this, will test ASAP.

We have just launched our website live, so I will need to wait until the development environment has been re-established.
Hopefully this should be ready tomorrow, will update once I have tested.

Kind Regards,
Jason

4
General Questions / Re: Alternate Meta Tags
« on: November 20, 2014, 11:28:41 pm »
Thanks Harald,

Worked perfectly as usual!

From what I read, using the 4 digit code will indicate for Google to target the search results to the specific Country, whereas using the 2 digit code will target anyone who's system is setup as the language. So for the amount of countries we target, this addition awesome! Thank you again.

Just noticed, it also mentions you should include the tag for the current language you are on, as well as the other language versions. (is this what is removed in the first part of the If/else statement?)

Thanks,
Jason

Reference
https://support.google.com/webmasters/answer/189077?hl=en

5
General Questions / Re: Alternate Meta Tags
« on: November 19, 2014, 07:11:43 am »
Thanks Harald,

Worked a trick!

I have tried to get tricky and have it display the 2 digit code for any unified languages, but display the 4 digit code where I have 2 variations (en-US/en-GB and fr-FR/fr-CA)

The below code changed every link dependant on if FR-CA/en-US was selected, not just the loop entry for a single line (FR/US showed 4 digit codes for ALL <link> elements while the other languages showed 2 digit)

Code: [Select]
} else {
  $tag = $current->getTag();
  $lang->active = false;
  if ($tag == 'fr-CA' || $tag == 'en-US') {
    if (($lang->menutitle != '') && ($params->get('alternatetag'))) {
    $doc->addHeadLink($lang->link, 'alternate', 'rel', array(
      'type' => 'text/html',
      'hreflang' => $lang->lang_code,
      'lang' => $lang->lang_code,
      'title' => $lang->menutitle
    ));
    }
} else {
if (($lang->menutitle != '') && ($params->get('alternatetag'))) {
$doc->addHeadLink($lang->link, 'alternate', 'rel', array(
'type' => 'text/html',
'hreflang' => substr($lang->lang_code, 0, 2),
'lang' => $lang->lang_code,
'title' => $lang->menutitle
));
}
}
}

Where could I move the IF statement to have it apply to the loop through each language WITHIN a single page.
(so only US FR are 4 digit)
Code: [Select]
<link href="/us/" rel="alternate" type="text/html" hreflang="en-US" lang="en-US" title="Home" />
  <link href="/de/" rel="alternate" type="text/html" hreflang="de" lang="de-DE" title="Startseite" />
  <link href="/fr/" rel="alternate" type="text/html" hreflang="fr" lang="fr-FR" title="Accueil" />
  <link href="/ca/" rel="alternate" type="text/html" hreflang="fr-FR" lang="fr-CA" title="Accueil" />
  <link href="/it/" rel="alternate" type="text/html" hreflang="it" lang="it-IT" title="Pagina iniziale" />
  <link href="/es/" rel="alternate" type="text/html" hreflang="es" lang="es-ES" title="Inicio" />
  <link href="/cn/" rel="alternate" type="text/html" hreflang="zh" lang="zh-CN" title="起始界面" />

Thanks,
Jason

6
General Questions / Re: Alternate Meta Tags
« on: November 11, 2014, 11:31:37 pm »
Hi Harald,

Just wondering if there was a specific file I could modify, to change how the hreflang is displayed.

Was hoping to add a little if statement for some of them that changes them from 4 digit ISO code to 2 digits.

Would this modification even be possible?

Thanks,
Jason

7
General Questions / Re: Alternate Meta Tags
« on: November 05, 2014, 10:57:35 pm »
ok great, found the setting within the jdlanguage module... Had been looking in the plugins.

Would it be hard to modify some of them to just the 2 digit ISO code, or are these taken straight from the joomla language file?

ie: de-DE would target not just the German language, but Germany as well.
    Where as de would target anyone who speaks German.


Also, it is mentioned that you should also show this tag for the language of the page your on as well, not just the others.
Would this be possible to add manually if I knew which files to edit?


Thanks,
Jason

8
General Questions / Alternate Meta Tags
« on: November 05, 2014, 07:43:17 am »
Hi,

I have just launched our website using jdiction, and I have been looking into the SEO aspect of it and what multilingual brings to the game.

Sounds like the <link rel="alternate" and hreflang="" > tags play a big part in this.

Joomla core has this if you use associated menus, but as this plugin removes the need to associate menus is there an alternate way to implement these into the website?


All documentation I have found says to add something along the lines of

   <link rel="alternate" href="http://www.domain.com/us/" hreflang="en-us" />
   <link rel="alternate" href="http://www.domain.com/de/" hreflang="de" />
   <link rel="alternate" href="http://www.domain.com/es/" hreflang="es" />

which is easy enough in index.php, but is this then meant to adjust to

   <link rel="alternate" href="http://www.domain.com/us/english-name" hreflang="en-us" />
   <link rel="alternate" href="http://www.domain.com/de/german-name" hreflang="de" />
   <link rel="alternate" href="http://www.domain.com/es/spanish-name" hreflang="es" />

etc for other pages?

If so can this data be pulled from the Jdiction data on the fly in anyway? ie.

   <link rel="alternate" href="<current URL>" hreflang="<current lang tag>" />
   <link rel="alternate" href="<german equivilant link>" hreflang="<german tag>" />
   <link rel="alternate" href="<spanish equivilant link>" hreflang="<spanish tag>" />

Any advise/tips from anyone that has done this aspect of a multilingual site before would be appreciated.

Regards,
Jason

9
General Questions / Re: Drop down menu
« on: September 15, 2014, 07:00:21 am »
I tried using this $language->title_native in place of the code I am currently using, but it kept returning nothing. Are there any prerequisites for it to work?

10
General Questions / Re: Drop down menu
« on: September 10, 2014, 02:26:29 am »
Just wanted to document a quick method I used to create a drop down menu effect for the jdlanguage module in case anyone else was looking to do the same.

Notes:
My 1st attempt of a technical write up, so apologies if its hard to follow.
I'll try differentiate between whats needed for it to work, and what I did specifically for our version.
Positioning is also important to create the effect, so it helps if the module position your using to display jdlanguage in is position:relative, so that you can use absolute positions within this container.
Lastly, I used JQuery for the drop down functionality.

Step One: Set-up
For this to work you need to set the jdlanguage modules Style (under basic options) to "Text-only".
--> I also set Show Current Language to "No" so I could display current language as the drop down menu text (step Four(B)).

Step Two: Create Drop Down List
Add following CSS to display the languages vertically
Code: [Select]
div.languageswitcher a {
display:block;
text-decoration: none;           /* this is personal preference */
}

Step Three : Style Drop Down List
Add the following to modify look of drop down.
Code: [Select]
div.languageswitcher {
display:none;
position:absolute;
z-index: 999999;                 /* my menu was displaying under a banner */
width:120px;                     /* resize, so your longest language fits in without linebreak */
        top:20px;                        /* this is the height of the drop down menu button we create in step four */

/* Personal Styles */
        padding: 5px 0px 5px 0px;
        background-color: #ffffff;
border-left: thin solid #ccc;
border-right: thin solid #ccc;
border-bottom: thin solid #ccc;
text-align:center;
border-radius:0px 0px 5px 5px;
}

Step Four(A): Create Drop Down Button. (simply)
Create a custom HTML module within the same module position as the jdlanguage module. with the following.
Code: [Select]
<div id="languagemenu">Select Language ▼</div>

Step Four(B): Create Drop Down Button. (with language item)
Create a Flexi Custom Code module (or your preference for adding php) within the same position as the jdlanguage module with the following.

--> Couldn't find if there is a simply $lang->getNative(); that could simplify this step.
Code: [Select]
<div id="languagemenu">
<?php 
$lang 
JFactory::getLanguage();
$tag $lang->getTag();
if (
$tag == 'en-GB') {
 echo 
"English (UK) ▼";
}
if (
$tag == 'en-US') {
 echo 
"English (US) ▼";
}
if (
$tag == 'de-DE') {
 echo 
"Deutch ▼";
}
if (
$tag == 'es-ES') {
 echo 
"Español ▼";
}
if (
$tag == 'fr-FR') {
 echo 
"Français ▼";
}
if (
$tag == 'fr-CA') {
 echo 
"Français canadien ▼";
}
if (
$tag == 'it-IT') {
 echo 
"Italiano ▼";
}
?>

</div>
http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules/15251

Step Five: Styling Drop Down button
Once again you can style to taste. But for the effect, the #languagemenu and .languageswitcher widths needs to match (note: including padding). Also the .languageswitcher top: needs to match the #languagemenu height, so it drops down from under the button.
Code: [Select]
div#languagemenu {
width: 120px;                    /* match .languageswitcher width */

        /* Personal Styles */
border-radius: 5px;
border: 1px solid #CCC;
height: 20px;
background: #FFF;
text-align:center;
padding: 4px 0px 0px 0px;
}
div#languagemenu:hover {
cursor:pointer;
}

Step Six: Give it life!
To have the drop down work, now you just need to add some jquery to your .js file.
Code: [Select]
$(document).ready(function() {
     $('#languagemenu').click(function(){
          $('.languageswitcher').slideDown();
     });
     $('.languageswitcher').mouseleave(function(){
  $('.languageswitcher').slideUp();
     });
     $('.languageswitcher a').click(function(){
          $('.languageswitcher').hide();
     });


Hope this helps anyone else wanting to get a drop down menu for this great plugin. This will auto populate as you add languages as it IS the core jdiction module restyled, with the exception of needing to updated step four(B) if you use it.

Attached are images of the final effect.

11
General Questions / Error when importing to default language.
« on: September 10, 2014, 12:55:57 am »
Hi  Harald,

Before translating our website, we cleaned up or default language master exports (uk-english) as there were a few us-english items and errors. We then imported these in as en-gb overriding the core website content. (this worked for the menus, modules and k2-items xliffs, but on importing the article content, I get a white screen only showing [query, db error]. The exact xliff imports perfectly to any language other than the default.

Should I be able to import to the default language? or will these require manual updating?

Thanks,
Jason

12
General Questions / Re: Blank Screens
« on: September 04, 2014, 05:03:15 am »
Thank you Harald,

Had an odd issue where jdiction.xml-bak was still being picked up when uploading the new .xml preventing this fields from showing (is this something with xml files specifically as I use this naming convention all over the place .php-bak, htaccess-bak, etc with  no troubles)?

But got it working once left only the one file in the directory.

I ended up adding the this code
Code: [Select]
export="false" filter="JComponentHelper::filterText"to the 2 lines that were un-commented.
Code: [Select]
<field type="textarea" name="extra_fields" export="false" filter="JComponentHelper::filterText">Extra Fields</field>
<field type="textarea" name="extra_fields_search" export="false" filter="JComponentHelper::filterText">Extra Field Search</field>
export=false was added as the export was "as you mentioned" is in a format that would be easier to manually do than go through the CAT tool, (also there where a lot closing > where missing from the </target and </source for the extra fields when exported. (not all but majority))

I also added the filter, as one of the custom fields is an image tag that was being stripped on saving. This fixed it.

Thank you again for the great support.


13
General Questions / Re: Blank Screens
« on: September 03, 2014, 09:55:47 am »
Where does uncommenting these 2 lines change? Do they become available in the k2-item translation screen? similar to
image_caption
image_credits etc?



14
General Questions / Re: Blank Screens
« on: September 01, 2014, 07:20:23 pm »
Great thank you will look into the menu alias stuff, but sounds like manual tweaking them is way to go.

I had commented out the 2 lines for extra fields but nothing changed when clicking the translate button. Only see theother fields options that were there already. Are there any other requirements to have this show or dependant on what extra fields I have set up?

15
General Questions / Re: Blank Screens
« on: September 01, 2014, 03:17:05 am »
Hi Harald,

Which xml would i need to alter to have the alias field appear in an xliff export?

Could JFilterOutput::stringURLSafe() be utilized on this field during either saving (manual update) or importing?
http://docs.joomla.org/Supporting_SEF_URLs_in_your_component#The_Alias


Also trying to add in the K2 extra fields so they can be translated (even just manually). Would along the lines of adding
Code: [Select]
<field type="text" name="K2ExtraField_6">Extra Fields</field>
to the jdiction.xml in com_k2 be on the right track? (using the field name that I use [matches k2 input name])?

Basically would love to be able to get the extra field from image 1 attached, and have it appear under the translation menu like the other fields in image 2? As at the moment this one line will remain in english. Guessing this one is so tricky as everyone's Extra fields are different.

Thanks again for the great support on a great extension. Very much appreciated.

Pages: [1] 2