PHP function to make slug (URL string)

Instead of a lengthy replace, try this one: public static function slugify($text, string $divider=”-“) { // replace non letter or digits by divider $text = preg_replace(‘~[^\pL\d]+~u’, $divider, $text); // transliterate $text = iconv(‘utf-8’, ‘us-ascii//TRANSLIT’, $text); // remove unwanted characters $text = preg_replace(‘~[^-\w]+~’, ”, $text); // trim $text = trim($text, $divider); // remove duplicate divider $text … Read more

Localization and internationalization, what’s the difference?

Internationalization (i18n) the process of changing your software so that it isn’t hardwired to one language/locale/culture. Localization (l10n) the process of adding the appropriate resources to your software so that a particular language/locale is supported. It’s bigger in scope than just this Wikipedia entry, but it’s a good start. The value of distinguishing between them … Read more

How to force NSLocalizedString to use a specific language

NSLocalizedString() (and variants thereof) access the “AppleLanguages” key in NSUserDefaults to determine what the user’s settings for preferred languages are. This returns an array of language codes, with the first one being the one set by the user for their phone, and the subsequent ones used as fallbacks if a resource is not available in … Read more

List of All Locales and Their Short Codes?

The importance of locales is that your environment/os can provide formatting functionality for all installed locales even if you don’t know about them when you write your application. My Windows 7 system has 211 locales installed (listed below), so you wouldn’t likely write any custom code or translation specific to this many locales. Edit: The … Read more

JavaScript for detecting browser language preference [duplicate]

I think the main problem here is that the browser settings don’t actually affect the navigator.language property that is obtained via javascript. What they do affect is the HTTP ‘Accept-Language’ header, but it appears this value is not available through javascript at all. (Probably why @anddoutoi states he can’t find a reference for it that … Read more

What is the significance of 1/1/1753 in SQL Server?

The decision to use 1st January 1753 (1753-01-01) as the minimum date value for a datetime in SQL Server goes back to its Sybase origins. The significance of the date itself though can be attributed to this man. Philip Stanhope, 4th Earl of Chesterfield. Who steered the Calendar (New Style) Act 1750 through the British … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)