Philip Pegden
Philip Pegden

Reputation: 2164

XCode 13 - generating Localizable.strings file for development langauge (English in my case), without using genstrings

I wanted to know how to generate the English base case Localizable.strings file in Xcode 13 without using genstrings.

I'm using the new compiler support to extract strings for localisation then exporting -> translating -> importing via the .xcloc files. All this works nicely, aside from one problem...

I'm having difficulty getting it to create the initial Localizable.strings file in the development language, i.e. en in my case. When I try and import the relevant en.xcloc file nothing happens. I can import other languages without problem.

Here are the steps I am taking:

  1. Write some basic code with one piece of text that can be localised
  2. Select Product -> Export Localisations... and choose English - Development Language

Correctly creates en.xcloc file - contents as expected, picking up the text to be localised.

  1. Select Product -> Import Localisations... and re-import the english en.xcloc file

This does nothing. So I try the following:

  1. Go to Project's file -> Info tab and add a new language, say (Fr)
  2. Select Product -> Export Localisations... and choose English - Development Language and French options
  3. Open fr.xcloc file and add translations required
  4. Come back to Xcode and import fr.xcloc file
  5. Now the Localizable.strings file appears - it is of course the French version
  6. Importing the en.xcloc file still does nothing
  7. If I open up the file inspector on the right, I can click to add an English version, but it simply copies the French version (which causes lots of other issues)...

I think where I'm coming from, is that because one doesn't have to rely on genstrings in Xcode 13, I'm wondering how to create the initial translation files.

Upvotes: 5

Views: 2440

Answers (1)

Philip Pegden
Philip Pegden

Reputation: 2164

Xcode only creates a Localizable.strings file when importing the en.xcloc file, assuming this is your development language, if you go into the exported en.xcloc file and change one of the translations. Then when import the updated file a Localizable.strings file will appear for en, yet only containing the changes you have made, rather than entries for all the keys.

Upvotes: 3

Related Questions