A cache-compatible WordPress plugin which converts all prices of the currency of
your choice in a post or page in the viewer’s local currency. LocalMoney relies
on the WP-cron system to fetch and cache the rates from
Open Exchange Rates
fetch the appropriate rate data. This means that, unlike some plugins I could mention,
LocalMoney is compatible with caching plugins.
LocalMoney, once configured, immediately (or as soon as your cache updates) acts
on all your posts and pages without you having to mark up the prices in your text.
- Determines the reader’s country via IP address, using IP2C
- Resolves proxies with the ‘forwarded-for’ header so AOL-compatible
- If IP2C fails uses the language settings and timezone offset to guess location
- Obtains exchange rates from openexchangerates.org
- Uses AJAX so that converting currency values doesn’t delay page load times
- Caches exchange rates locally to minimize calls to openexchangerates.org
- Output prices matched to format of input prices (i.e. with or without cents)
How to Use
Once LocalMoney is installed it will take any page on which US dollar prices are
displayed and convert them to the visitors local currency. If your posts are written
with another currency you can change the base currency in the Settings > LocalMoney
Currently LocalMoney has not been translated to any languages other than English.
If you wish, feel free to create a translation. Here are the basic steps:
- Copy “localmoney-en.po” to “localmoney-LANG_COUNTRY.po” – fill in LANG and COUNTRY with whatever you use for WPLANG in wp-config.php.
- Grab a transalation editor. POedit works for us.
- Translate each line.
- Send your new localmoney-LANG_COUNTRY.po file to email@example.com.
- Your translation will be incorporated in the next release.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Go to openexchangerates.org and sign up for a free account.
- Copy your API key (should be a string of 32 alphanumeric characters).
- Go to Settings > LocalMoney and paste the API key into the field.
- On the same page if your own currency is not the US Dollar select it.
- If you are using a caching system you may want to empty your cache in order to benefit from the plugin immediately.
- What do I have to do to tell LocalMoney where the prices are on my page?
- How does LocalMoney decide which currency to convert to?
In order to make the lookup process more robust the LocalMoney plugin uses a main
and a fallback mechanism to lookup a visitor’s location.
The main system is the IP2C (IP to country) lookup service which is included with
the plugin. If the user is accessing your site via a proxy the ‘Forwarded-for’ header
will be used, allowing users from AOL to benefit from this plugin.
The fallback system looks at the visitor’s language preference. If it is in the form ‘en-GB’ it will
use the appropriate currency for GB which is Pound Sterling. If the language preference
is in the form ‘en’ it will check the timezone offset of the user and guess the
appropriate country from that, i.e. in the case of ‘en’ the following data will be
0 – 24->
gb gb gb gb gb in in ch au au au au nz nz us us us us us us gb gb gb gb
Under the fallback system, because the currency is determined by the settings on
the user’s machine, a visitor who happens to be in a foreign country still gets
their own currency not the local one (unless they have changed their timezone settings).
Contributors & Developers
“LocalMoney” is open source software. The following people have contributed to this plugin.Contributors
- Fixed a bug that prevented currency updates in some circumstances.
- Removed rounding in initial content parse to increase overall accuracy of conversion.
- Converter now removes any blocks of three digits prefixed by a ‘.’ or ‘,’ to remove all thousands separators.
- Added facility for converter to handle currencies where a decimal comma is used.
- Ensured compatibility with WordPress 3.6.1 and updated documentation accordingly.
- Changed all occurrences of ‘DIR‘ with ‘dirname(FILE)’ in order to be backward-compatible
with PHP installations prior to 5.3.
installation was not in the domain root.
- Corrected miscellaneous bugs
- Base currency selector added to admin page.
- Code added to handle non-US Dollar currencies as base.
- New fancy banner designed for WordPress hosting page.
- GPL_V2 now included as part of plugin
- Various miscellaneous revisions to the readme.txt