Which is generally best to use — StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase?

Newer .Net Docs now has a table to help you decide which is best to use in your situation. From MSDN’s “New Recommendations for Using Strings in Microsoft .NET 2.0” Summary: Code owners previously using the InvariantCulture for string comparison, casing, and sorting should strongly consider using a new set of String overloads in Microsoft … Read more

Best practice multi language website

Topic’s premise There are three distinct aspects in a multilingual site: interface translation content url routing While they all interconnected in different ways, from CMS point of view they are managed using different UI elements and stored differently. You seem to be confident in your implementation and understanding of the first two. The question was … Read more

Why does Chrome incorrectly determine page is in a different language and offer to translate?

Update: according to Google We don’t use any code-level language information such as lang attributes. They recommend you make it obvious what your site’s language is. Use the following which seems to help although Content-Language is deprecated and Google says they ignore lang <html lang=”en” xml:lang=”en” xmlns= “http://www.w3.org/1999/xhtml”> <meta charset=”UTF-8″> <meta name=”google” content=”notranslate”> <meta http-equiv=”Content-Language” … 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

Is it possible to update a localized storyboard’s strings?

There are two options: Option 1 Xcode can “reload” the file by converting the file to either an [Interface Builder Cocoa Touch Storyboard] file type or a [Localizable Strings] file type. Select your base storyboard file from the Project Navigator Find the Localization section in the File Inspector If your file is currently a [Localizable … Read more

What’s NSLocalizedString equivalent in Swift?

I use next solution: 1) create extension: extension String { var localized: String { return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: “”, comment: “”) } } 2) in Localizable.strings file: “Hi” = “Привет”; 3) example of use: myLabel.text = “Hi”.localized enjoy! 😉 –upd:– for case with comments you can use this solution: 1) Extension: extension … 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

Schema for a multilanguage database

What do you think about having a related translation table for each translatable table? CREATE TABLE T_PRODUCT (pr_id int, PRICE NUMBER(18, 2)) CREATE TABLE T_PRODUCT_tr (pr_id INT FK, languagecode varchar, pr_name text, pr_descr text) This way if you have multiple translatable column it would only require a single join to get it + since you … Read more

How to use localization in C#

Add a Resource file to your project (you can call it “strings.resx”) by doing the following: Right-click Properties in the project, select Add -> New Item… in the context menu, then in the list of Visual C# Items pick “Resources file” and name it strings.resx. Add a string resouce in the resx file and give … Read more

How to determine user’s locale within browser?

The proper way is to look at the HTTP Accept-Language header sent to the server. This contains the ordered, weighted list of languages the user has configured their browser to prefer. Unfortunately this header is not available for reading inside JavaScript; all you get is navigator.language, which tells you what localised version of the web … Read more

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