The Right Tool For The Job: Picking The Best Prototyping Software For Your Project


  

Prototyping tools have become an important resource for us designers — allowing us to document multiple states of a single screen, including animations, transitions and microinteractions that are hard to represent in static documentation.

The Right Tool For The Job: Picking The Best Prototyping Software For Your Project

Companies that pay attention to this trend have started to build prototyping tools to address this need; and today we’re seeing a plethora of tools emerge on a regular basis. But which should you pick? More importantly, what questions should you ask yourself and your team to make sure you choose the right one?

The post The Right Tool For The Job: Picking The Best Prototyping Software For Your Project appeared first on Smashing Magazine.


Source: Smashing Magazine

Heroku Alternative: Deploy Apps with Dokku on DigitalOcean

When Heroku announced their (quite reasonable) new limits for free apps, I realized that I would have to find another source of hosting for all the small, low-traffic projects that I currently have running on Heroku. Way back in the day, Heroku was totally free for apps that only required one dyno, but after years of abuse from jerks like me, they dropped that to eventually allowing free apps to run for 18 out of 24 hours per day (which is ok for low-traffic prototypes) and as of June 1, granting a shared pool of free hours.

Since I have such an unreasonable number of apps running on Heroku, I thought it was high time to try out Dokku. Dokku is a Heroku-like tool that allows you to deploy complex apps by simply pushing with Git. It supports Heroku buildpacks directly, so you can transition existing apps without difficulty, and has a number of plugins for datastores and other components. And, thankfully, Digital Ocean provides a pre-installed Dokku image that will spare you the trouble of installing Dokku yourself; you can just spin up a server and start Dokku-ing right away! This article will walk you through setting up a Dokku server on DigitalOcean with your own root domain and deploying a simple static site to it.

Differences between Dokku and Heroku

  • Dokku requires at least some comfort level with running your own servers; you may have to modify nginx configurations, manually configure some plugins, or turn to the system tools for debugging.
  • Dokku utilizes Docker, which is a fine platform but can add an extra layer of complexity to a server install.
  • Dokku requires root access to a VPS to install plugins, run commands, etc.

In short, you’re going to need to do a bit more command line setup on Dokku than Heroku — nothing you can’t pick up along the way, but you might need to do some light reading.

Creating a Dokku Server on DigitalOcean

DigitalOcean logo

First, log in to DigitalOcean and follow this link to create a new server on DigitalOcean using the preinstalled Dokku app. Dokku requires at least 1GB of RAM, but $10/mo to host all your stuff is a pretty small price.

For your hostname, enter the base domain you want to use to host your apps. Default Dokku apps will appear at <appname>.<hostname> (for example, myapp.example.com). Make sure you own this domain and register it if you need to!

Continue reading %Heroku Alternative: Deploy Apps with Dokku on DigitalOcean%


Source: Sitepoint

The Best Nootropic Smart Drug for Entrepreneurs is Nutrition

Nootropics

For an entrepreneur, the most important tool is a fully functioning brain. This should be easy since we all come with a brain built in to our system, but sometimes they just don’t function as optimally as we’d like them to. Sometimes they need a little boost, and for some this means seeking out aid in the form of nootropics.

What are Nootropics?

Both nootropics and smart drugs are supplements taken to enhance cognitive function, but many have the misconception that they’re the same thing. In fact, true nootropics have no negative side effects and do no damage to your neuronal structure. Smart drugs, on the other hand, come with side effects such as irritability, mood swings, stress, anxiety, and adverse reactions to appetite and sleep (think Bradley Cooper in Limitless). They can also be addictive and do long-term damage to your health.

While nootropics may work for some entrepreneurs, and other individuals that need all the brain boost they can muster (students, for example!), are they really an ideal choice? Although there are more and more nootropic supplements emerging onto the market, there’s another natural way to boost mental performance that doesn’t require breaking the bank or taking supplements.

Good old-fashioned nutrition!

Eating for Mental Performance

Many ancient cultures, our ancestors, and those that don’t have easy access to pharmaceuticals still manage(d) to stay healthy in both body and mind by using food as medicine. Nutrition is an easy, natural and inexpensive way to keep the brain sharp and performing at its peak.

Here are some essential foods and nutrients that should be included in every entrepreneur’s diet.

Choline

Eggs

Choline needs to be eaten in order to produce a neurotransmitter called acetylcholine. This neurotransmitter in the nervous system is essential for concentration, memory and focus. It plays a key role in our ability to store short-term memories. The biggest source of choline is found in eggs because the yolk contains lecithin (in which choline is found).

Choline can also be consumed through organ meats (such as liver), milk, and whole wheat foods. An egg for breakfast could be the only nootropic you need for a working brain in the morning. Be careful not to eat too many though — they contain high levels of cholesterol.

Proteins

Protein is made up of amino acids, which then make up neurotransmitters such as serotonin and dopamine (the feel-awesome hormones). These hormones lead us to feel happy, stress-free, and with an enhanced sense of mental clarity — all of which contribute to high energy levels.

Protein can be found in lean meat, poultry, seafood, dairy products and eggs ⏤ essentially anything that is (or comes from) an animal.

Continue reading %The Best Nootropic Smart Drug for Entrepreneurs is Nutrition%


Source: Sitepoint

Redux Authentication: Secure Your Application with Auth0

Redux is all the rage in the React community and beyond right now, and with good reason. It’s a library created by Dan Abramov that brings sanity to handling unidirectional data flow and allows developers to use powerful development features like time travel and record/replay.

Sounds great right? Here’s the rub: it comes at the price of needing to write more code. However, if you’ve had any experience maintaining large applications, you might know that data handling can become unwieldy and hard to manage. With Redux, we can have a clear view of the state of our application at all times and know exactly what our data is doing.

In this tutorial we’re going to take a look at how to get a start at creating a real-life React + Redux application that authenticates users and calls a remote API for data. Our app will retrieve a list of Star Wars Jedi from a Node backend so we can display their names and photos. For authentication we’re going to use Auth0 so that we can get up and running quickly and also easily get features like social login and multifactor authentication.

single jedi

We won’t dive into the elementary concepts of Redux, so if you’re new to the library, check out some of these great getting started resources:

The source code for the app we’ll be building can be downloaded here.

Redux Authentication: Getting Started

Our React project for this tutorial will be written in ES2015 so we’ll use Babel to transpile down to ES5, along with webpack to handle module bundling. Instead of setting things up from scratch, why don’t we start with Dan’s real-world starter example in the Redux repo. Grab a copy of that and install the dependencies.

npm install

Sign up for Auth0

The best way to do authentication for single page apps (like the one we’re building) is to use JSON Web Tokens (JWT). JWTs provide a way to do stateless authentication against a RESTful API, and this offers many benefits over session and cookie-based auth. The downside is that rolling our own solution for JWT authentication can be tricky and error prone, but fortunately we can use Auth0 and not worry about any server or security implementation details.

If you haven’t already done so, head over and sign up for a free Auth0 account. With the free plan we get 7,000 regular active users and can use two social identity providers.

After registering, follow the prompts to initialize your account. Keep in mind that you can have multiple applications under the same account, so select a domain name that is suitable to your situation—perhaps the name of your organization. As a first step, we need to set our localhost URL as an allowed origin. This can be done in the “Allowed Origins (CORS)” textarea.

auth0 dashboard

Set up the Web Server

Why don’t we get the Jedi web server out of the way first. This just needs to be a simple RESTful API that returns our Jedis in the form of JSON data, and quick way to do this is with NodeJS using the Express framework. You can use any server-side language or framework you like, as long as JSON data is returned.

Note: The Star Wars purists will note that we’re using “Jedis” as the plural form of Jedi throughout the application, but this isn’t the correct pluralization. Rather, we should simply be using “Jedi”. Maybe so, but I’m ok with it because it makes things easier in our app 🙂

First, initialize an app and install the dependencies:

mkdir server && cd server
touch server.js
npm init
npm install express express-jwt cors

We can provide all the code that our server will need in a single JavaScript file.

// server.js

const express = require('express');
const app = express();
const jwt = require('express-jwt');
const cors = require('cors');

app.use(cors());
app.use(express.static('public'));

// Authentication middleware provided by express-jwt.
// This middleware will check incoming requests for a valid
// JWT on any routes that it is applied to.
const authCheck = jwt({
  secret: new Buffer('AUTH0_SECRET', 'base64'),
  audience: 'AUTH0_CLIENT_ID'
});

var jedis = [
  {
    id: 1,
    name: 'Luke Skywalker',
    image: 'http://localhost:7000/images/luke-skywalker.jpg'
  },
  {
    id: 2,
    name: 'Anakin Skywalker',
    image: 'http://localhost:7000/images/anakin-skywalker.png'
  },
  {
    id: 3,
    name: 'Yoda',
    image: 'http://localhost:7000/images/yoda.png'
  },
  {
    id: 4,
    name: 'Obi-Wan Kenobi',
    image: 'http://localhost:7000/images/obi-wan-kenobi.jpg'
  },
  {
    id: 5,
    name: 'Mace Windu',
    image: 'http://localhost:7000/images/mace-windu.jpg'
  }
];

app.get('/api/jedis', (req, res) => {
  const allJedis = jedis.map(jedi => { 
    return { id: jedi.id, name: jedi.name }
  });
  res.json(allJedis);
});

app.get('/api/jedis/:id', authCheck, (req, res) => {
  res.json(jedis.filter(jedi => jedi.id === parseInt(req.params.id))[0]);
});

app.listen(7000);
console.log('Listening on http://localhost:7000');

We’ve got an array of Jedis and two endpoints to handle them. The first endpoint returns all of the Jedis, but only their id and name properties. The second endpoint at /jedis/:id returns a single Jedi, but also includes the image URL too. This second endpoint is the one that we are going to protect with our authentication middleware and have it limited to only authenticated users.

But how do we actually protect this endpoint? We’re using express-jwt to create a middleware that looks for an incoming JSON Web Token and verifies it against a secret key that we provide. We can then apply this middleware to any of our endpoints—which we are doing with the second argument to the /jedis/:id endpoint—and only those requests that include a valid token with them will be allowed through.

The middleware itself is setup by supplying our Auth0 secret key and client ID to authCheck, and this is where you can provide the keys specific to your application. These keys can be found in the Auth0 management dashboard under applications.

The Jedi images are coming from a public directory on the server. You can grab the same images from the repo or you can include links to images from other sources in the data if you like as well.

With the server in place, let’s verify that the API is working as expected. We can do this with a tool like Postman.

postman

If we go to the /api/jedis route, we’re able to get the full list of Jedis as expected. However, if we try to get one Jedi, we aren’t allowed to get the resource back because we aren’t sending a token to the server.

postman invalid token

We’ll see how to send tokens with our requests once we implement our API calls in the application itself, but essentially all we need to do is include it in an Authorization header using the Bearer scheme.

Setting up Redux

Auth0Lock

Auth0 accounts come with an awesome pre-built widget called Lock which greatly simplifies the process of actually logging into an app. We can get the JavaScript required for this widget from Auth0’s CDN.

<!-- index.html -->

<!-- Auth0Lock script -->
<script src="https//twitter.com//cdn.auth0.com/js/lock-9.1.min.js"></script>

<!-- Setting the right viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

Routing

We’re going to limit our application to a single route for the sake of brevity. There are some authentication concerns when it comes to routing, such as limiting certain routes to only those users who are authenticated, but that’s the subject for a future article. For now, let’s keep things simple and define a single route.

// routes.js

import React from 'react'
import { Route } from 'react-router'
import App from './containers/App'

export default (
  <Route path="/" component={App}></Route>
)

This gives us a base route that uses a component called App.

Setting up the Actions

Reducers are at the heart of Redux, and they give us a clean and predictable way to change the state of our application. When using Reducers, we need to make sure that no data gets mutated. This gives us the benefit of being able to inspect every previous state of the data in our app, and it’s an important concept in Redux.

While reducers are the crux, we still need actions to make things happen in the application. Let’s put in all of the actions we’ll need for our Jedis application.

Continue reading %Redux Authentication: Secure Your Application with Auth0%


Source: Sitepoint

Calypso: The Desktop App for WordPress

I use WordPress for most of my work. Whether I’m building WordPress websites for clients, or I’m writing blog posts and developing content for my own sites. Everything I do tends to involve WordPress. However, I don’t like always having to do things in the browser. Trust me, I have enough tabs open as it is. That’s why I was excited to hear about Calypso, WordPress’ desktop app for writing and editing blog posts. I’ve been wanting a separate desktop app for a long time, so I decided to try it out.

Calypso WordPress Desktop App

Are You Managing Multiple WordPress Sites?

Calypso is perfect for you! All you need to do is download the desktop apps from WordPress.com and enable management from the dashboard of each site (or Jetpack for self hosted sites). Then, you can edit posts as needed, updating them with new content. You can also create new posts. You can go to the icon of your profile and go down to the bottom right section where it says to add a WordPress site. Imagine not having to log in and out of every WordPress site you own. You can simply log into the Calypso interface and make a site active for adding or editing posts.

Adding sites

Working with Multiple Accounts in Calypso

After you’ve entered the credentials for all of your sites, you can click on ‘My Sites’ in the top left corner of the app, and you’ll see a stats page for the most recent site selected. You’ll see information about the number of visits you’ve received, where they are from and their search terms, and what posts and pages they have visited. You’ll also see the top referring sites that are sending visitors to your website.

Continue reading %Calypso: The Desktop App for WordPress%


Source: Sitepoint

Sourcehunt: PHP7-Only Alternative to Laravel, HPKP, and More

Time to promote some open source projects again!

Sourcehunt logo

paragonie/hpkp-builder [15 ★]

This library aims to make it easy to build HTTP Public-Key-Pinning headers in your PHP projects, and requires at least PHP 7.

HTTP Public Key Pinning, or HPKP, is a security policy delivered via a HTTP response header much like HSTS and CSP. It allows a host to provide information to a user agent about which cryptographic identities it should accept from the host in the future. This can protect a host website from a security compromise at a Certificate Authority where rogue certificates may be issued for your hostname.

Read more about HPKP here.


Rican7/incoming [137 ★]

Incoming is a PHP library designed to simplify and abstract the transformation of loose, complex input data into consistent, strongly-typed data structures.

// Create our incoming processor
$incoming = new IncomingProcessor();

// Process our raw form/request input into a User model
$user = $incoming->process(
    $_POST,            // Our HTTP form-data array
    new User(),        // Our model to hydrate
    new UserHydrator() // The hydrator above
);

Explaining it to any great detail is outside the scope of this short post, but in essence it allows us to precisely define what kind of input information goes through and hydrates our model, rejecting, filtering, or transforming everything else.

It’s like Fractal, backwards. (Fractal makes sure the output matches a set structure, rather than input)

The library currently has one outstanding issue – and it’s a discussion around a feature – but could definitely use some users and feedback! Maybe even a SitePoint post about it?

Continue reading %Sourcehunt: PHP7-Only Alternative to Laravel, HPKP, and More%


Source: Sitepoint

How the Humble Speech Bubble Will Transform Our Future UIs

Last week, I ran a simple experiment. I handed my friend a piece of paper and a pencil and told him to draw two people.

He obligingly sketched some stick figures.

“Okay,” I said. “Now draw the first person telling the second person to walk the dog.”

My friend immediately outlined a speech bubble above the head of the left figure and wrote in big letters, “Go walk the dog!”

As I had hypothesized, his go-to method for showing conversation was a speech balloon. But what if we didn’t have this default? It would be surprisingly tricky to depict dialogue–you could add it somewhere to the picture, maybe as a caption or hovering in the air–but then it wouldn’t be clear who was saying what to whom.

Turns out, this humble icon is actually pretty important in design. Let’s dive into the speech bubble’s origins, then explore how it’s used today.

The Invention of the Speech Bubble

When you think of “modern inventions,” you probably don’t think of speech bubbles. However, these spherical symbols are actually a far more recent invention than guns, microscopes and telescopes, and even the steam pump.

Before artists had speech bubbles, they used bandelores. Picture a long, unfurling rectangle filled with text extending from someone’s mouth. Yeah, not pretty.

Bernhard Strigel - 1506
Painting: Bernhard Strigel – 1506

As Independent writer Rhodri Marson comments, They “emerged incongruously from people’s mouths, looking a bit like massive supermarket till receipts and about as difficult to read.”

Bandelores were en vogue into the 18th and 19th centuries; in fact, the leading caricaturists of the time used them to satirize Napoleon, Nelson, and the royal family. But as artists realized these extended scrolls were hard to read, they began moving to other conventions.

Extract for 'The Yellow Kid' comic strip - 1895 to 1898

When the Yellow Kid (which historians consider to be the first comic strip) was published in the New York Journal in 1895, its characters’ words appeared on their chests. However, by 1896, they were floating above their heads in balloons. The speech bubble had been born.

These days, it’s almost impossible to pick up a comic book and not find speech bubbles. But thanks to their universal association with communication, they’ve spread far beyond their paper origins.

Why Were Speech Bubbles a Hit?

The cause of the speech bubble’s enduring popularity isn’t self-evident. First, if you look at the vast majority of universal icons, they bear a close resemblance to their “real-life” counterparts: take the envelope icon, which typically stands for “message,” or the trash can icon, which nearly always means “delete.”

The speech bubble, on the other hand, doesn’t look like anything we’d recognize in our normal existence-probably because “speech” doesn’t have a real-world analog we can see or touch.

Plus, usability research shows that even the most common, seemingly straightforward icons (like the heart, the clock, and the bookmark) are frequently misunderstood.

So, how did the speech bubble not only survive in design–but thrive? I have a theory.

First, after the Yellow Kid, speech bubbles became ubiquitous in comic books. After all, they’re infinitely useful: artists use them to attribute quotes to specific figures, show the sequence of dialogue and even portray how characters are speaking.Different modes of speech bubbles

And comic books were incredibly popular during the twentieth century. Men, women, boys, and girls of all different backgrounds, classes, and ages read them, not just little kids. Consequently, everyone grew to recognize the meaning of the bubble.

The shape of the speech balloon also played (and continues to play) a role. We find circular shapes appealing on a subsconscious level: they feel warm, friendly, and natural. In addition, rings usually suggest unity and relationships.

So, every time you see a speech bubble, you’re hit with a wave of positive associations. You’re also subtly reminded of communities–which, if you think about it, makes a speech bubble the ideal symbol for a communication method.

Continue reading %How the Humble Speech Bubble Will Transform Our Future UIs%


Source: Sitepoint

Internationalizing WordPress Projects: The Introduction

A few years ago, I wrote about the process of internationalizing WordPress-based projects. Though I think there are some times when tutorials don’t necessarily need updating, refreshing, or revisiting, there are other times in which we can all benefit from revisiting the topic.

After all, software changes from year to year, and we also gain experience as we continue to work with a given piece of software. WordPress is no different. 

Starting with this article and continuing to the next set of articles, we’re going to take a look at the following:

  • what internationalization means within the context of WordPress
  • how we can internationalize our work
  • how internationalization and localization differ
  • tools that are available for localization
  • how to internationalize content that’s contained within JavaScript
  • and more

We’re even going to build a small albeit functional WordPress plugin that will help us practically demonstrate the points that we’ve listed above.

Before we get started, though, it’s important to understand what internationalization is and what WordPress offers in the way of doing it. Furthermore, there are a few gotchas that may surprise you, especially if you’re an experienced programmer.

With that set out as the outline of this series, let’s get started on getting a solid grasp in internationalizing our work in WordPress.

What Is Internationalization?

The WordPress Codex is always one of the best places to start when you’re looking to learn more about a given topic. Here’s what it offers in the way of internationalization (which we also abbreviate as i18n just in case you see it written that way):

Internationalization is the process of developing your plugin so it can easily be translated into other languages.

Furthermore, the Codex goes on to describe exactly why this is important:

Because WordPress is used all over the world, it is a good idea to prepare a WordPress plugin so that it can be easily translated into whatever language is needed. As a developer, you may not have an easy time providing localizations for all your users; You may not speak their language after all. However, any developer can successfully internationalize a theme to allow others to create a localization without the need to modify the source code itself.

It makes sense, right? WordPress powers roughly a quarter of the web, and it’s being used all over the world. Why should the work that we’re providing remain in the native language we speak?

This is not to say that there aren’t times in which this is okay. For example, if you’re building a solution for someone and you know that they along with a small-ish group are going to be using the application, then it makes sense to leave it in the native language of said client.

But if you’re building something for widespread distribution, there’s no doubt that you should be internationalizing your work.

In short, internationalization is the process by which we make sure our work can be translated into another language.

Forget Everything You Know About Variables

Later in this article, we’re going to take a look at the functions in the WordPress API for making sure our PHP strings are properly internationalized. But there’s an incredibly important caveat that you must remember.

Do you recall when you first learned about variables in whatever programming language way back when? It was awesome, right? You could define a variable one time and then reuse that variable in place of the string (or whatever other value) every other place in the code so that you didn’t have to repeat yourself. 

In fact, it’s part of the core tenets of programming, isn’t it?

The DRY principle is stated as “Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.”

I absolutely, nearly unequivocally agree with this definition. But when it comes to the internationalization of strings in WordPress, we must make an exception. You’ll see why momentarily, but I chose to include this section here so that you can avoid any potential future mistake. I also opted to mention this so that you don’t ask about trying to use variables within the context of the internationalization API in the future points of contact.

If you remember this now, you will avoid this hurdle later.

The Internationalization API

At this point, we are ready to look at the functions WordPress provides. We won’t be putting them to work in this particular article, but we will be looking at the function names, how to use them, and what they are used for in a larger context.

Starting in the next article, we’ll begin putting them to use. For now, let’s take a look at what’s available.

  • __() is arguably the most popular or most common internationalization function that you will find in WordPress work. This function accepts a single string to be translated and the text domain to which it will belong. It should never include anything except a string (that is, no HTML, no JavaScript, etc.).
  • _e() is similar to the above function, but rather than just retrieving the translated version of the string, it will also echo the result of the translation to the screen.
  • _x(): unfortunately, there are times where a given string will return the wrong translation. When this happens, using this function is helpful, especially when specifying the context of how the string was translated. This will ensure the intended version of the string is returned.
  • _ex(), just like _e() and _x() listed above, will make sure the proper translation of the string is echoed to the screen based on the specified context so that the incorrect version is not selected during runtime.
  • _n() is a neat function because it allows WordPress to select the single or plural version of the specified number based on which is being used. This means that we, as developers, have to provide strings for both the single and plural version so translators can translate it, along with the actual number. But it makes working with internationalized numbers much easier than without.
  • _nx() should be, at this point, clear as to how it works. It’s a combination of _n() which we just shared and _x() which was covered above. This means that if you’ve properly specified the singular and plural form of the specified number along with the proper text domain, then the translation will appear as expected.
  • _n_noop() should sound somewhat familiar to those who are familiar with computer science or computer engineering. A NOP is short for “no operation” and, in this case, it’s used to have translated, plural strings that we don’t necessarily want to use at a particular time but might want to retrieve later. In short, the translator can provide the translation and we can select when to use them.
  • _nx_noop() is a combination of the above function and the _x() function we’ve seen so many times before. This will allow us to gain access to a translation for a particular text domain without actually having to translate them.
  • translate_noop_plural() reads a bit differently than the functions we’ve examined thus far, but the implementation is quite simple: This function provides a translation of the result of _n_noop() and _nx_noop().  The key thing to note about this function is that it expects the first argument to be an array with the singular and plural keys that come from the aforementioned functions.
  • esc_html__() is very similar to __(), but it’s intended for use in HTML tags. That is, it’s not meant to translate HTML tags, but it’s meant to grab the translation and escape it for safe use within the context of HTML.
  • esc_html_e() is just like the function above it and almost exactly like the _e() function we looked at above; however, it’s meant to be used to go ahead and echo the result of the translation to the screen.
  • esc_html_x() should be clear at this point given how many times we’ve seen _x() used in other functions. In short, this will do the same thing as _x(), but it will provide the text in the gettext context and will prepare it for safe use in HTML.
  • esc_attr__() is used to take the specified string and properly escape it so that it can be used safely as an attribute such as the title attribute of an image.
  • esc_attr_e() will display the translated text with an additional encoding of any characters such as greater than, less than, ampersands, and quotes. This is another function that is intended to be used within the context of an attribute of another element.
  • esc_attr_x() will grab the translation, escape it, and then render it in the context of an element’s attribute. If no translation has been provided, then the default string that was provided during development time will be used.
  • number_format_18n() is a powerful function, especially when you’re working with a variety of locales. For example, if you’re working with a number and you want to render “1,000” then you’d not specify a second parameter for this function; however, if you’re working with currency or decimal places, then you would want to pass ‘2’ as the second argument so that two digitals would be appended after a decimal.
  • date_i18n() is another powerful function that will allow you to retrieve the date in a localized format based on the specified timestamp. To learn more about this particular function, its parameters, and examples of how it’s used, please review its Codex page.

Remember in the section above where I talked about avoiding the use of variables? This is where that comes in handy. As you’ve no doubt noticed, each of the functions above takes in two parameters:

  1. the string that can be translated
  2. the text domain of the string

The text domain refers to a unique relationship between the WordPress plugin or WordPress theme, WordPress, and the translator. Ultimately, it’s to make sure that the translator is able to provide a translation of the string without overriding the translation of another string elsewhere in WordPress (or another third-party solution).

Ultimately, your best bet is to use the slug of the plugin as the text domain. Furthermore, this parameter should always be a string, not a variable. Thus, no matter how many times you end up having to type it out, do not store it in a variable. Just type the text domain as the second parameter to the function.

This has to do with how translation tools work, and we’ll be looking at this in more detail in a future article.

Conclusion

And that’s the primer on the internationalization functions. If you’re still a bit confused on how to apply some of these in your work, don’t worry. There’s more to cover both in terms of explanation and in terms of practical demos.

For example, we briefly touched on the concept of gettext, right? And what about JavaScript? Furthermore, what about the tools that we have available to allow others to translate our strings? How do we know they’re working properly?

All of this is going to be covered in this series. But before we get there, we needed to start with the basics. So that’s what we’ve done. In the next article, we’ll resume by talking a bit about gettext and some of the available tools.

After that, we’ll turn our attention to actually writing code (including JavaScript) and how it all fits together within the context of our very own WordPress plugins.

In the meantime, if you’re looking for other utilities to help you build out your growing set of tools for WordPress or for example code to study and become more well-versed in WordPress, don’t forget to see what we have available in Envato Market.

If you’re interested in learning more about WordPress from a development perspective, note that I exclusively work with WordPress and often write about it. You can catch all of my courses and tutorials on my profile page, and you can follow me on my blog and/or Twitter at @tommcfarlin where I talk about software development in the context of WordPress.

Don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.


Source: Nettuts Web Development

Accessibility Matters: Meet Our New Book, “Inclusive Design Patterns” (Pre-Release)


  

Accessibility has always been a slightly unsettling realm for web developers. Surrounded with myths, misunderstandings and contradicting best practices, it used to be a domain for a small group of experts who would “add” accessibility on top of the finished product.

Pre-release: Inclusive Design Patterns written by Heydon Pickering

Today we’re privileged to announce our brand new book on inclusive design patterns, written by Heydon Pickering, with dozens of practical examples of accessible interface components and inclusive design workflow, applicable to your work right away. With this book, you’ll know exactly how to keep interfaces accessible from the very start, and how to design and build inclusive websites without hassle and unnecessary code.

The post Accessibility Matters: Meet Our New Book, “Inclusive Design Patterns” (Pre-Release) appeared first on Smashing Magazine.


Source: Smashing Magazine