Trikalabs
  • Home
  • Best online TDD videos
  • Book Suggestions
  • About Me
  • Contact
Trikalabs
No Result
View All Result

Project Mess #1: No Localised Strings.

by fragi
May 13, 2021
in Project Mess
Share on FacebookShare on Twitter

Every app has some static text. Either as a title of a screen or as a title of a button, or just as plain text. In most of the cases we can see them inside nib files or as hardcoded values inside Swift files.

Many times this approach can be very messy and can lead in a lot of unnecessary work to maintain the project and to add or mostly change some text in the app. A requirement to gather all the static text of the app and give them to the legal department in order to review them, or a requirement to localise the text in another language are maybe not so common but for sure can happen. Also if suddenly the UX team wants to change the messages of all the “close” buttons can be very painful if all the static is not in one place.

Fortunately we can plan ahead and introduce localisation from the beginning or at least the sooner the better , if the project is not greenfield. Xcode provides an easy way to achieve it.

Let’s assume that we have the following view:

In order to add localisation we have to tap on the project file and create a String resource. Name the file as “Localizable”.  Then all we have to do is to add the static text strings in this file:

And as final step we have to replace the static text to our localized strings:

fragi

fragi

Related Posts

Project Mess

Multiple Equatable methods on different Packages – Bad practise

May 24, 2023

In this article we will explore what happens when we have different equatable methods for a type across packages and...

Project Mess #3: Hardcoded UI colours
Project Mess

Project Mess #3: Hardcoded UI colours

February 19, 2022

In this short article we will see another project mess.Let's see the following example: A worst variation of this...

Project Mess #2 – Magic numbers for UI spacing
Project Mess

Project Mess #2 – Magic numbers for UI spacing

February 18, 2022

In this short article we will address one common issue that can lead to a project mess is when all...

Next Post
Dependency Injection – UIViewController with a Nib file

Dependency Injection - UIViewController with a Nib file

Unit testing UIViewController LifeCycle

Unit testing UIViewController LifeCycle

Unit testing code with DispatchQueue

Unit testing code with DispatchQueue

  • Advertise
  • Privacy & Policy
  • Contact

© 2019 Trikalabs Ltd. All rights reserved.

No Result
View All Result
  • Home
  • About Me
  • A curated list with the best free online TDD videos
  • Book Suggestions
  • Pinner Code Club

© 2019 Trikalabs Ltd. All rights reserved.