Closed Bug 1140010 Opened 9 years ago Closed 9 years ago

Provide a tableName to NSLocalizedString()

Categories

(Firefox for iOS :: General, defect)

All
iOS 8
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: st3fan, Unassigned)

References

Details

NSLocalizedString() has an optional tableName: argument.


I would like to suggest that we use this to group strings that belong to the same high level component. Examples of high level components are "Settings", "History Panel", "Reading List".


So that when you use this as follows:

... Taken from HistoryPanel.swift ...

        case 0: return NSLocalizedString("Today", tableName: "History Panel", comment: "Text label for a section in the history panel")
        case 1: return NSLocalizedString("Yesterday", tableName: "History Panel", comment: "Text label for a section in the history panel")
        case 2: return NSLocalizedString("Last week", tableName: "History Panel", comment: "Text label for a section in the history panel")
        case 3: return NSLocalizedString("Last month", tableName: "History Panel", comment: "Text label for a section in the historypanel")

The exported xliff will contain this:

  <file original="Client/History Panel.strings" source-language="en" datatype="plaintext" target-language="it">
    <header>
      <tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="6.1.1" build-num="6A2008a"/>
    </header>
    <body>
      <trans-unit id="Last month">
        <source>Last month</source>
        <note>Text label for a section in the history panel</note>
      </trans-unit>
      <trans-unit id="Last week">
        <source>Last week</source>
        <note>Text label for a section in the history panel</note>
      </trans-unit>
      <trans-unit id="Today">
        <source>Today</source>
        <note>Text label for a section in the history panel</note>
      </trans-unit>
      <trans-unit id="Yesterday">
        <source>Yesterday</source>
        <note>Text label for a section in the history panel</note>
      </trans-unit>
    </body>
  </file>

This grouping is useful to localizers because it defines the context better. And it also lets people divide the work more easily.

The filename "Client/History Panel.strings" is artificial. AFAIK we wont actually have things split up like that. But I could be wrong. Need to investigate (although it wont matter I think)
OS: Mac OS X → iOS 8
Hardware: x86 → All
I don't think we are going to do this for existing strings as it will chnge the structure of the exported xliff files in a significant way. We can only do this for completely new modules like extensions or bigger parts of the app that do not yet have strings.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.