Localizable.strings how to create in Fire?

Hello, I’m learning IOS programming and i have question with Localizable.strings
I know how to create it in XCode but i don’t know how it is connected with project in Fire , should i manually create folder for example en.lproj or is any other path ??
Can someone to explain me that ?
Mateusz

OK i clicked try and I know how to do it :slight_smile: in Xcode it works …
Should i add generated folder in Xcode to my Fire project because i can’t get string from localizable strings using NSLocalizedString(key:“xx”, comment:"")

I didn’t set build action in Fire…for my Localizable.strings - now all works fine.

you got it working?

Not exactly … if I generate Localizable.strings for en and pl (polish) i Got 2 folders how to add it to project as resources ?? (If I added one after one from 2 folders I have only one in app - the last one added)
Files have the same name but every folder has unique name en.lproj and pl.lproj

to be quite honest, I’m not sure; I’ll need to have a look at how Xcode handles this, as I never dealt with this part before. you will probably need to set the proper AppResource build action on both files — but there might be more to it, possibly some build-time pre-processing. I’ll see what Xcode does and either let you know how tom solve it or (if needed) add the necessary logic to EBuild to make it possible.

Update: to clarify one part: you’ll want the en.lproj folders as project item, with build action AppResource. not the individual files. Much the same as its done with, say, .xcassets. the folder should be treated as opaque file, by the build.

OK. Can You check it for Interface Builder (many languages resources too) ??
I used this great tutorial to understand it :slight_smile: step by step…

Update : to clarify one part: you’ll want the en.lproj folders as project item, with build action AppResource. not the individual files. Much the same as its done with, say, .xcassets. the folder should be treated as opaque file, by the build.code generate it in this way

Xcode generate it in this way… I’m learning IOS as you know it’s all new for me here… I try and get information and later I want to use it in Fire …

CopyStringsFile /Users/mh/Library/Developer/Xcode/DerivedData/localizationtest-botcxdxyfceksefnyjivsaajnylv/Build/Products/Debug-iphonesimulator/localizationtest.app/en.lproj/Main.strings /Users/mh/Test\ Projects/localizationtest/localizationtest/en.lproj/Main.strings (in target 'localizationtest' from project 'localizationtest')
    cd /Users/mh/Test\ Projects/localizationtest
    builtin-copyStrings --validate --outputencoding binary --outdir /Users/mh/Library/Developer/Xcode/DerivedData/localizationtest-botcxdxyfceksefnyjivsaajnylv/Build/Products/Debug-iphonesimulator/localizationtest.app/en.lproj -- /Users/mh/Test\ Projects/localizationtest/localizationtest/en.lproj/Main.strings

damn your eyes. Looks like converting the string files to a .plist is done by a function built into Xcode thats not available as external tool. Sigh. :frowning:

As a workaround for now, you might need to maintain your .strings files as .plist to start with…

As i understood one for pl second for en?? And take language for system??
Ok i will generate my own class with method, i will take language from system and get key value from my strings (logic will be closed in one method) ok

Yes, you’ll want Base.lproj, en.lproj and pl.lproj folders in your project (say, under Resources). inside each you’d have, say Main.string. You’d add the three folders to the project, and set their build action to AppResource:

Ok folders should be in resources? I got it in files… Maybe here was the problem… I will try in a minute…add folder not a file?

Correct, because you want each folder copied as is into the final .app as a whole.

if you’d add the individual files, the files would each get copied (ignoring the structure of their source location). and because they are all named the same, only one would survive ;).

Once this all works, I can do more work IDFE side to make the contents of the .lproj’s more accessible/workable-with in the IDE.

1 Like

Marc excuse me , the problem is because there is no info how to do it so I Have to write often to You.

No worries; thats what I’m here for.

1 Like

Marc , after a few months I back to this subject can you give some example with working 2 languages StoryBoard ??
I don’t want to "map " every label to my resource via IBOutlet - can I do it ??
In Xcode I added 2 lanuages and generate strings for StoryBoard and after changing language all works as expected… How can I do it the same way in Fire ?

P.S I can’t find any info on talk about this and in documentation too…please help me with this subject :slight_smile:

Best regards
Mateusz

Not off-hand, I’m afraid. I’ve never used this feature ein Xcode (or Cocoa in general). I’d suggest to look at how thins looks in Xcode, and then copy/replicate the same in Fire, file wise.

Can you help me with this ? I’m not IOS specialist :frowning: I wrote 2 apps using your tools but I don’t know all the complexities and dependencies…
Can you ?

Best regards
Mateusz

I’m not really an expert in this area either, I’m afraid; I’d have to do the same online research into how this works as you would.

Localization - Apple Developer and Localization | Apple Developer Documentation would be good starting points, I think.

yours,
marc