From 120356bf8e82fbec11a252728aff152a43156d9c Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sat, 17 Dec 2022 00:01:08 +0100 Subject: [PATCH] Implemented the "localise(key: )" static function in the String+Helper extension for the Browse module. --- .../UI/Extensions/String+Constants.swift | 11 +++++++++++ .../UI/Extensions/String+Localisations.swift | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 Modules/Sources/Browse/UI/Extensions/String+Constants.swift create mode 100644 Modules/Sources/Browse/UI/Extensions/String+Localisations.swift diff --git a/Modules/Sources/Browse/UI/Extensions/String+Constants.swift b/Modules/Sources/Browse/UI/Extensions/String+Constants.swift new file mode 100644 index 0000000..2dbb2f9 --- /dev/null +++ b/Modules/Sources/Browse/UI/Extensions/String+Constants.swift @@ -0,0 +1,11 @@ +// +// String+Constants.swift +// Browse +// +// Created by Javier Cicchelli on 16/12/2022. +// Copyright © 2022 Röck+Cöde. All rights reserved. +// + +extension String { + static let empty = "" +} diff --git a/Modules/Sources/Browse/UI/Extensions/String+Localisations.swift b/Modules/Sources/Browse/UI/Extensions/String+Localisations.swift new file mode 100644 index 0000000..2883ece --- /dev/null +++ b/Modules/Sources/Browse/UI/Extensions/String+Localisations.swift @@ -0,0 +1,19 @@ +// +// String+Localisations.swift +// Browse +// +// Created by Javier Cicchelli on 16/12/2022. +// Copyright © 2022 Röck+Cöde. All rights reserved. +// + +import Foundation + +extension String { + static func localise(key: String) -> Self { + NSLocalizedString( + key, + bundle: .module, + comment: .empty + ) + } +}