Marking strings to be ignored for localization

Don’t translate this now and don’t ask me again next time.

Problem

Strings in source code start as text surrounded by quotes "abc". The developer examines each string and sorts them into three choices; Localize: LocalizationString("abc"), Don’t Localize: "abc", or I’m undecided and for now do not want to make a choice: "abc". Note that the two last choices look the same. Every time the source code is examined for unwrapped strings, the strings that are not to be localized would continue to be flagged as "does this string need to be translated?".

Keeping track of strings that are not to be localized typically requires a list that is separate from the source code. The difficulty with a list is that a string in one line of code that should not get translated might be the same as a string in another line of code who’s localization fate is undecided. Additionally, the strings that should not be localized could be changed in the source code and no longer be on the list.

One technique is to keep track of the do not localize strings and their locations within a source code file, but as code is changed, the location of strings can change. The goal is to have a developer choose to not localize a string and then to never ask them again.

Solution

The patent marks strings that are not to be localized with a function that returns what you feed it NOP("abc"). Alternatively the do not localize strings could be wrapped with parents ("abc") since for most compilers the parens are ignored. Marking the string in the source code eliminates the need for a separate list of what not to localize, and makes it very clear in the source code the status of a string (localize, don’t localize, undecided). Localize = LocalizationString("abc"), Don’t Localize = ("abc"), and Undecided = "abc".

Impact

It is easy to distinguish "do not localize" from "localization is undecided" strings. The next time through the source code, it is obvious which strings to present again to the developer so that they can choose to localize or not. This technique is accurate, allows a string to be in one of three states (localize, do not localize, undecided), and does not rely upon some external data set to keep track of the status of a string.

Status

US Patent Application Number 62065717
Filed 19-OCT-2015