iOS - genstrings: couldn't connect to output directory en.lproj
Asked Answered
V

3

11

I searched for this error online and here. Online it shows me results in a different language then english nice Google. Here it has one post and a guy that never really answered the guys question.

I have my xcode project folder on my desktop. Inside the project folder I have an en.lproj folder that has both iPad and iPhone storyboards inside along with a localization.plist file. However when I launch the project in Xcode this en.lproj folder is nowhere to be found. So this might be the problem?

With the project folder on my desktop I launch terminal type in: cd

then drag my project folder into Terminal and it gives me the path. I then paste this line of code into the Terminal

find . -name *.m | xargs genstrings -o en.lproj

I get this error message in the Terminal:

genstrings: couldn't connect to output directory en.lproj

it prints this line multiple times and then says my project is a path to a directory?

No .strings file is made. Any thoughts on what I am doing wrong? I got UILabels that I dragged and dropped from inside Storyboards, but I also I strings that are coded with

NSLocalizedString(@"First Level Passed", @"This is a message displayed on screen to allow the user to know they have passed the first level!");

So the above Terminal code snippet should be finding those NSLocalizedStrings right? I think it isn't even getting to find the en.lproj folder in the first place but I don't know?

Any help would be great.

Verticillate answered 12/9, 2012 at 11:4 Comment(1)
I too am getting N "couldn't connect to output directory en.lproj" message, did you solve your issue?Yerkovich
C
17

Better late then never,

you are creating a file (localizable.strings) in the folder projectroot/en.lproj. If this folder doesn't exist you get this error message. Simply create the folder en.lproj in the root and the command should work.

Christean answered 27/3, 2013 at 13:25 Comment(0)
H
5

I got the same error, while execute the following command as per the tutorials.

genstrings -o en.lproj *.swift

Above command gives me following error:

genstrings: couldn't connect to output directory en.lproj

My issue:

  • I try to implement above command on my own directory(i.e. subdirectory of root project directory) where all the ".lproj" directory is there. - that gives me above error.
  • Then i have removed old “Localizable.strings” on sub-folder "Localization". and created new “Localizable.strings” in root directory. - here i got no errors but nothing is happen as per "genstrings" command.

Solution:

On command line move to the Root directory of project where you can get the all the ".lproj" directories.

Add the path of file, where you listed all the "NSLocalizedString("TEXT", comment: "COMMENT")" - in my case i have listed everything on "Constants.swift" file.

So, i have execute the following command and its work like charm.

 genstrings -o en.lproj/ #ProjectPath#/Constants/Constants.swift

Note: File path will be easily get via just drag file from the Xcode and drop to the terminal.

Hutner answered 29/6, 2019 at 8:14 Comment(0)
A
0

Solution is to manually create the folder en.lproj, then run genstring command

cd {project folder}
mkdir Localization
cd Localization
mkdir en.lproj
genstrings -o en.lproj/ ../*.swift

repeat for every language (ie: fr.lproj ) for French etc..

Autarky answered 15/5, 2021 at 8:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.