The Contact Form 7 for WordPress is a nice simple plugin to build contact forms fast. But when it comes to making it completely multilingual it lacks a bit.
I am currently creating a website with 13 different languages, that would mean to create the same contact form 13 times, not really practical :)
I am translating the form labels on the fly with some javascript magic, but for the messages I had to go a bit deeper.
1 2 3 4 5 6 7 8 |
public function message( $status ) { $messages = $this->messages; $message = isset( $messages[$status] ) ? $messages[$status] : ''; $message = $this->replace_mail_tags( $message, true ); return apply_filters( 'wpcf7_display_message', $message, $status); } |
1 2 3 4 5 6 7 8 |
public function message( $status ) { $messages = $this->messages; $message = isset( $messages[$status] ) ? $messages[$status] : ''; $message = $this->replace_mail_tags( $message, true ); return __(apply_filters( 'wpcf7_display_message', $message, $status ),'textdomain'); } |
1 2 3 4 5 |
$contact_form_msgs = array( 'msg_1' => __('Your message was sent successfully. Thanks.','textdomain'), 'msg_2' => __('Failed to send your message. Please try later or contact the administrator by another method.','textdomain'), 'msg_3' => __('Validation errors occurred. Please confirm the fields and submit it again.','textdomain'), ); |
Cheers
Alex
The GitHub repository from Saša Stamenković provides a nice list of all countries with names and ISO 3166-1 codes.
Available formats are:
Sometimes when personalizing or translating interfaces, IP geolocation is required.
Besides their subscription based products Maxmind also provides a free IP Geolocation database set. The set is offered under the Creative Commons Attribution-ShareAlike 3.0 Unported License. The free databases maps IPv4 + IPv6 addresses and is being updated once a month. GeoLite Free Downloadable Databases
Another free set of data is provided by IP2location Lite. It is free for personal or commercial use with attribution required
The JSON spec allows integers, fractional numbers, strings, arrays, but when it comes to dates things are handled differently. There really is no date format in the JSON spec. Would be nice if every JSON date output would conform to ISO8601 :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// Ruby 2011-07-14 19:43:37 +0100 //ISO 8601 2011-07-14T19:43:37+0100 // Javascript Date Object new Date(1310669017000) // Javascript built-in JSON object 2012-04-23T18:25:43.511Z // .NET JavaScriptSerializer Date(1310669017000) // .NET DataContractJsonSerializer Date(1335205592410-0500) |
Some of these can easily be converted to a PHP timestamp using strtotime(), others require some more magic.
Here is a way to transform the .NET variant, something that has been haunting me in a current project ;)
1 2 3 4 |
preg_match('~(\d+)\d{3}((?:\+|-)\d+)~', $date, $match); $dt = new DateTime('@' . $match[1]); $dt = new DateTime($dt->format('Y-m-d H:i:s') . ' ' . $match[2]); $date = strtotime($dt->format('r')); |
Due to the wide usage of JSON as an exchange format, I really hope we will see a spec update in the future :)
“Masonry is a JavaScript grid layout library. It works by placing elements in optimal position based on available vertical space, sort of like a mason fitting stones in a wall. ”
Still the best solution out there.
PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
The JavaScript SVG library for the modern web. Just what the doctor ordered ;)
Nice jQuery plugin that easily enhances your tables and even provides a pager if needed. The plugin is also Bootstrap compliant.
morris.js is a really nice chart lib for jQuery, that provides line, bar and donut charts.
“PhoneJS contains everything you’ll need to create native client applications using HTML5 and JavaScript with a single codebase and deliver solutions that target today’s most popular smartphones and tablet devices.
With a touch-optimized user experience, natively rendered widgets, straightforward page navigation, view management, and data access layers, PhoneJS is a single page application (SPA) framework for your next iOS, Android and WindowsPhone application, ready for online publication or packaged as a store-ready native app using Apache Cordova (PhoneGap).”
Really thinking about using it for one of my upcoming projects. Best documentation I have seen for a long time. Will build a test app next year :)