Macrotone Blogs

Macrotone blogs upon Joomla, our products and other matters.

Making a component truly Multilingual (1)

One of the first requests we received for our Issue Tracker component after its initial release was to make if ‘Multilingual’.  At the time we were rather busy but recorded the request with the intent to implement it later when circumstances permitted.. We recently decided to look at the changes involved in more detail but decided to look at our Rialto component, which is not so complex and would (should) be easier to modify.

It is important to clarify exactly what is meant by a component being ‘Multilingual’.  It is one thing to have language translations available for a component that can be loaded upon a site to permit the component to display the inbuilt ‘text strings;’ in the native language of the site, but this does not in itself make the component ‘Multilingual’.  Perhaps the best definition is that a site can be considered ‘Multilingual’ if it is possible to support more than one language such that one can switch from one to another via a single mouse click.  Items like site categories, menu items, and articles etc. would at the same time change to be in the selected language. A component would be ‘Multilingual’ if it can itself support such transitions. The classic Joomla component that does this is of course the ‘com_content’ component.

There is one other aspect that needs to be mentioned and this is the matter of ‘Associations’.  Joomla permits an article, or a category (amongst other things) to have an assigned language.  If one were to translate an article into another language then the site would have two (or more) identical articles each the same apart from the specific language. Joomla then permits one to ‘associate’ the one article with the other, such that the ‘seamless’ change on changing the language in use is switched is achieved.

Of course one does not necessarily have to translate all articles, and it is possible to define a default language (indicated by a ‘*’) which is display which ever site language is in use.

Our Rialto component, which is a Classified Advertisement component, is a situation where it is expected that a ‘Multilingual’ site would possibly have categories in different languages, which are probably ‘associated’ but that the specific adverts themselves (known as entries) are unlikely to be present in anything other than the one language. This does not mean that advert entries might not be in multiple languages just that the situation is not likely to be so common.

We shall describe some of the changes that were required to achieve what we desired, but given the number of changes required will split it into several parts. We will endeavour to avoid ‘too’ much specific code, and instead concentrate on the areas where we made our changes. We will also describe a few ‘opportunities’ for enhancement that we discovered whilst implementing the changes.

Just before we start into the detail it is worth mentioning that there is a component name ‘JAMultiLingual’ from Joomla Arts that can be used to set up a Joomla site for ‘Multilingual’ and certainly aids in getting started into Joomla Multilingual. It is not the only possibility but one which we have used and found very well constructed.

Language Field

The first step is to add the additional ‘language’ field to the database tables that we wish to have language contained within.

ALTER TABLE `#__rialto_categories` ADD `language` CHAR(7) NOT NULL COMMENT 'Language code';

Obviously we require the same column present upon all tables not just the one indicated. We also have to consider whether to apply a default language setting, possibly ‘All’ (*) for any existing entries that may be present in the database.

Having made the table change we then have to make the following code changes:

  • Change the component list and single item views so that the field is displayed.
  • Modify the Model ‘getItem’ (getItems) methods to return the additional language field to the views
  • Modify the Model Item ‘Save’ method so that the language field is updated when an item is updated or created. Ensure that a suitable default is applied if required
  • Note that one has to allow for the option that the component is being used upon non-multilingual sites and thus ensure that all situations are allowed for.  There are some standard Joomla language routines that enable one to test whether languages are installed (Method JLanguageMultilang::isEnabled() ), which aid in the coding.

These changes are ‘required’ for the back end, but may also be required in the front end if appropriate. It is not common to permit the creation (or editing) of Joomla categories in the front end, but it one permits the creation of ‘entries’ (articles)  in the front end, which is true for the Rialto component then we have to modify these as well. It is reasonable to assume that in the front end of the site, if a person is creating a new ‘entry’ that the language currently displayed on the site is the one in which they are entering the entry details. Otherwise one has to provide the user with the option of specifying the language they are using. 

These changes are required for all tables.

To be continued…..

Displaced anchor links when used with a fixed page header

We recently introduced a couple of new articles upon our site which made use of internal referenced anchor points to make navigation a little easier. We immediately saw a small problem, in that although the anchors worked and directed the viewer to the relevant part of the article, the positioning was below the required anchor point, so that the header and part of the text was obscured. This was caused by our using a fixed header on each page.

We pondered on the problem for a while and then found this interesting article on the web which described a virtually identical problem and a possible solution.

For those who only want the solution and in case the original article is ever removed, we reproduce our modified version of the solution below.

First, I moved the id’s of each h3 section to a new element: (a span in this case)

<span class="anchor" id="section1">span>
<h3>Section1h3>

The new elements were added right above each header section and would serve as the new anchor point. Whilst empty elements on a page are not perhaps the best solution, in this situation is certainly solves the issue.

Once the new elements were in place, a bit of CSS was added to the template custom css:

.anchor{
  display: block;
  height: 90px; /*same height as header*/
  margin-top: -90px; /*same height as header*/
  visibility: hidden;
}

It also works well with the responsive template and changing browser window sizing.

Tags:

IP Mapping, clustering, refresh – performance impacts

ipmappingWe mentioned the other day about using HTML5 to determine a site visitors location and using it to be displayed upon a Google map. We are here looking at the various options that need to be considered when setting the parameters for the best ‘site impression’.  I have deliberately used the term ‘impression’ because most of the ‘work’ is actually performed by Javascript in the users browser. Each user will most likely be using a different machine, i.e. Desktop, laptop, tablet, smartphone etc., not to mention the different processors included in each type, and all these will different performance characteristics.  This each user’s impression of ‘how fast’ a site actually is, will be different, and this is without considering the impact of any network performance in a) obtaining the source data from the web site and b) the transfer of data to/from the Google mapping servers.

Continue reading

Experiences with HTML5 mapping

ipmappingWe have recently been updating our IP Mapping Joomla component to handle HTML5 geolocation detection and thought this may be of interest to others.

IP Mapping was originally designed with the aim of displaying IP addresses upon Google Maps and experience has shown that although it works well it is very reliant upon the accuracy of the data held by the various database and communication suppliers. The various supplied of the IP to location mapping vary considerably in the accuracy of the location information. We ourselves have been ‘located’ as being several hundred miles away from where we were physically located, depending upon which IP-location provider we were using and when we were determining the location. Whilst this may be adequate for some, for others it is a little bit hit and miss. I am thinking here of a ‘local’ village or town intending to serve the local neighbourhood, who desire to know how widespread their visitors are.

Continue reading

Rialto a new classified ads component for Joomla

rialtoWe are pleased to announce a Classified Ads component for Joomla named Rialto.

This component runs on Joomla 3.4 (and above) only.  Wikipedia defines Classified advertising as a form of advertising which is particularly common in newspapers, online and other periodicals, which may be sold or distributed free of charge. Advertisements in a newspaper are typically short, as they are charged for by the line, and one newspaper column wide. An advertisement as seen in a newspaper, magazine, or the like is generally dealing with offers or requests for jobs, houses, apartments, used cars, and the like. The Joomla component permits a site to accept such advertisements from its registered members and acts as a conduit between purchaser and seller.

The name is derived from a historic market district of Venice, Italy, named the Rialto, located close to the Grand Canal and to the 16th-century Rialto Bridge. It became the business centre of medieval and renaissance Venice. Since that time the word has come to have a few other meanings such as 'agora', 'forum', 'marketplace', 'shopping place' etc.

Joomla Resources

In the spirit of spreading information about Joomla this short message provides a short list of free Joomla resources that can assist you in meeting your website construction goals.

b2ap3_thumbnail_joomla-documentation.gif
10 Joomla resources you can tap into:

Farewell to XMAP, Hello OSMAP

We have used the XMAP component for some time and were a little surprised when we discovered that this excellent component was no longer being supported, but not totally surprised since the last update was quite a while ago, but it performed well and did what it was intended to.  We had noticed that it had ceased working with EasyBlog but this was not a major concern (for us at least.)

We were therefore please when we discovered that OS Training (Alledia) were assuming the task of enhancing it.  We duly downloaded the 'new' OSMAP component and installed it and it worked flawlessly almost straight away.  A minor change to the Google Web Site and we were soon working again.

What was nice was that the EasyBlog XMAP plugin worked perfectly with the new version.  The only problem we discovered was when we tried to add the Kunena entries to our site map.  The entries were added to the site map but unfortunately when one clicked upon them the forum entries gave an 'access prohibited' message. The cause was because appended to each entry was '/list'.  Removal of the erroneous string and the link worked perfectly.  Fortunately we found this post in the Kunena forum which provided an alternative plugin which when installed resolved the link problem.

 

Benefits of a RAID configuration

We unfortunately suffered a hard disk failure over the weekend, which meant that a replacement was required.  We had been watching the ’Reallocated sector count’ rising on the specific disk for some time and it was in range of 2000 so were not totally surprised by the turn of events. One can run with a small number of reallocated sectors as the bad sectors will have been replaced with spares. Their Logical Block Addresses (LBA) having been reallocated to other physical sectors.  It is only when the number of spare physical sectors run out that one runs into real problems.   We also note that a couple of the other drives have a few reallocated sectors but these are in the low numbers and are not increasing so there is no need for concern at the moment.

Fortunately the disk was part of a RAID 6 configuration which meant that no data was lost and we could run in a degraded mode until such time as we could replace the disk.  We could even have survived a further failure, but fortunately that was not necessary.

The disk duly arrive and we plugged it in and restarted our QNAP system.  The drive was accepted and a RAID rebuilt immediately started.   It was as simple as that. No reconfiguration of need to do anything at all, just wait for the rebuilt to complete.  Simplicity itself.

This all helps justify our original decision, several years ago to purchase a QNAP system, and this is the first drive that we have had to replace, so it has paid for itself over the years.

In that time the drive technology has moved on, and our replacement drive, a Seagate Constellation ES,  whilst not being identical to the original, it being a later and ‘faster’ model, was a perfect match, and we note runs slightly cooler.

Tags:

Speeding up site loading

Came across this small post about improving the speed of a web site which I thought might be of interest to some.

It mentions the compression of JavaScript files using gzip by entering the following command in the .htaccess file.

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript

This doesn’t apply to our particular site since we already make use of the feature which is automatically inserted into the .htaccess file by Akeeba Admin Tools Pro by turning on "Automatically compress static resources" in the .htaccess maker

Quicken UK Personal Finance Part 2

qw2k43In an earlier post on this subject, we earlier mentioned our experiences in starting to upgrade our UK version of Quicken. This continues with our discoveries with the US version.

Having managed to obtain a copy of the US 2015 version from one of our contacts in the United States, we tried installing it on a test machine.

The first problem was that it didn't like the fact that our test machine had the earlier UK version installed, so we uninstalled and installed the 2015 US version.  This went well but when we tried torun it it complained about our locale for NON-UNICODE programs and that it should be set to set to 'English (United States)'.  So we changed the locale and tried again.

This time it requires us to register the version.   Here comes the second problem in that one requires a US address to be able to register the program. OK we can do that, so using the address of our US contact we try and register.  Unfortunately we cannot get it to register. It also soon becomes apparent that because we are located in the UK, we cannot access the US Intuit site via a browser either.

Time for a review:   The classic way to get around the problem of access to a US site which is restricting itself to thier own country is to use a VPN (Virtual Private Network).  One such product is named 'Tunnelbear' which enables one to 'fool' the target web site to think that one is in the US (or UK).  This particular VPN has a 'free' option so we install this and manage to successfully register the product.

Now we try and read our 2004 UK Qdata file.  It immediately objects to the file and says that it cannot read non US files.

Searching the web we discover that this is also a 'well known' problem. It is suggested that an earlier version of the US version for 2004 is used to read the UK files.  We can obtain a version from the US Intuit web site and we install this. We then try to read our 'updated 2004 UK' QData file.  Again we get reported error saying it can not read non US files.  Perhaps we can use a QIF file, which is an export from our 2004 UK version.  This has mixed success.  First the accounts that get created by the Import are all set to use the US currency. We get around this by first just importing the accounts, then modifying them so that they have the UK currency.  Then we try importing the data again.  It states that it reads 15000 records but we can immediately see that the final account values are incorrect.  It is obvious that the import has not handled the transactions that are between the different accounts.  In addition the dates of the transactions it has imported are wrong in most cases.  A number (most?) seem to have dates with the year in the early part of the 20th centrury.  i.e 190x., and there appear to be a number of transactions missing.

Given the number of transactions we are dealing with it is going to be a long winded task to check, and change the incorrect transactions  and Import them it is back to the drawing board.

So time for another review.  We have our 2004 UK version working fine and it seems to handle all that we require, is it worth the pain in continuing.  The answer has to be a resound no, so for the time being we will stay as we are and perhaps, and I mean perhaps, we will look at it again later, but for now we will leave it as it is.

Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries