5

my iOS application has localization for 10+ languages. I'd like to check that all screens looks ok (labels aren't too long/short etc).

I know I can go through my app and make screenshots using UI Automation. Is there any way do switch simulator's language in UI Automation? Is there any way to generate screenshots for my app just by launching 1 command?

Thanks!

OgreSwamp
  • 4,602
  • 4
  • 33
  • 54

3 Answers3

5

Yes there is. I just wrote it myself as a matter of fact. :)

Use this project: https://github.com/jonathanpenn/ui-screen-shooter

It's a demonstration of how to run UI Automation from the command line, swap simulator languages with a plist changing command, and choose simulator device types with an AppleScript. It's documented heavily with comments, but if you're confused about something, feel free to open an issue or a pull request on the project and we can improve it.

Jonathan Penn
  • 1,341
  • 7
  • 8
  • You might want to check out [snapshot](https://github.com/krausefx/snapshot), which does something very similar to `ui-screen-shooter`, but is actively being maintained. – KrauseFx Mar 27 '15 at 15:05
3

There is another github project called Snapshot, for exactly what you want.

It provides the same (and more) features that UI Screen Shooter has, and I found it to be a bit more fleshed out and documented.

The most challenging part of getting up and running is learning the Javascript API for performing actions in the simulator, but you can find many useful tutorials for that online.

Here are some useful references:

Matt Mc
  • 8,882
  • 6
  • 53
  • 89
1

I took the screenshots below during my tests for a osx app. It also works fine for ios app.

You can generate a unlimted number of scheme for your xcode project. If you do so, you can test your app in any language and get screenshots within your simulator. Ok, let's start by an example: Add a german language scheme to your project

After you have finished your localization, you have to add a new scheme for each language.

Step 1: Click on your current scheme (scheme panel in your tab bar). The scheme at the image below is JHDTestLayout:

scheme

Step 2: Now, you can manage your scheme. At first we have to add a new one:

add a new scheme

Step 3: Type in a name for your new scheme:

enter image description here

Step 4: Afterwards, click again on the scheme panel in your tab bar (Step 1), choose your new scheme and select "Edit scheme"

enter image description here

Step 5: Add two arguments to "Arguments Passed On Launch" section (by using +) and press OK:

enter image description here

Arguments Passed On Launch: You can also use other languages for different schemes, for example:

German

-AppleLanguages (de)
-AppleLocale de_DE

Espanol

-AppleLanguages (es)
-AppleLocale es_ES
user8675
  • 657
  • 6
  • 13
  • I'm looking for a way to do this via the command line. For some reason, the following doesn't work: `open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app --args -AppleLocale es_ES` I wish it did!!!! – livingtech Oct 22 '14 at 20:54