From a6d602b72612808a81292e01aad1c765ea9366f4 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 6 Nov 2023 01:23:21 +0100 Subject: [PATCH 1/4] feat: :construction: Starting conversion from any base to another --- BinaryConverter.xcodeproj/project.pbxproj | 8 ++-- BinaryConverter/AnyBaseConverter.swift | 48 +++++++++++++++++++++++ BinaryConverter/OctalConverter.swift | 18 --------- BinaryConverter/UtilsFunctions.swift | 14 +++++++ 4 files changed, 66 insertions(+), 22 deletions(-) create mode 100644 BinaryConverter/AnyBaseConverter.swift delete mode 100644 BinaryConverter/OctalConverter.swift diff --git a/BinaryConverter.xcodeproj/project.pbxproj b/BinaryConverter.xcodeproj/project.pbxproj index 7807a68..6dec7d8 100644 --- a/BinaryConverter.xcodeproj/project.pbxproj +++ b/BinaryConverter.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 2C53DAA62AF866B200EB233F /* AnyBaseConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C53DAA52AF866B200EB233F /* AnyBaseConverter.swift */; }; 2CCE3E9F2AF678B200BB0ED3 /* BinaryConverterApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3E9E2AF678B200BB0ED3 /* BinaryConverterApp.swift */; }; 2CCE3EA12AF678B200BB0ED3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EA02AF678B200BB0ED3 /* ContentView.swift */; }; 2CCE3EA32AF678B300BB0ED3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2CCE3EA22AF678B300BB0ED3 /* Assets.xcassets */; }; @@ -14,10 +15,10 @@ 2CCE3EAD2AF67A9000BB0ED3 /* UtilsFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */; }; 2CCE3EAF2AF67BA900BB0ED3 /* BinaryConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */; }; 2CCE3EB12AF67CFD00BB0ED3 /* HexaConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */; }; - 2CCE3EB52AF6879200BB0ED3 /* OctalConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EB42AF6879200BB0ED3 /* OctalConverter.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 2C53DAA52AF866B200EB233F /* AnyBaseConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyBaseConverter.swift; sourceTree = ""; }; 2CCE3E9B2AF678B200BB0ED3 /* BinaryConverter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BinaryConverter.app; sourceTree = BUILT_PRODUCTS_DIR; }; 2CCE3E9E2AF678B200BB0ED3 /* BinaryConverterApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryConverterApp.swift; sourceTree = ""; }; 2CCE3EA02AF678B200BB0ED3 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -26,7 +27,6 @@ 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilsFunctions.swift; sourceTree = ""; }; 2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryConverter.swift; sourceTree = ""; }; 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexaConverter.swift; sourceTree = ""; }; - 2CCE3EB42AF6879200BB0ED3 /* OctalConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OctalConverter.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -61,9 +61,9 @@ children = ( 2CCE3E9E2AF678B200BB0ED3 /* BinaryConverterApp.swift */, 2CCE3EA02AF678B200BB0ED3 /* ContentView.swift */, - 2CCE3EB42AF6879200BB0ED3 /* OctalConverter.swift */, 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */, 2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */, + 2C53DAA52AF866B200EB233F /* AnyBaseConverter.swift */, 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */, 2CCE3EA22AF678B300BB0ED3 /* Assets.xcassets */, 2CCE3EA42AF678B300BB0ED3 /* Preview Content */, @@ -151,9 +151,9 @@ files = ( 2CCE3EA12AF678B200BB0ED3 /* ContentView.swift in Sources */, 2CCE3EAF2AF67BA900BB0ED3 /* BinaryConverter.swift in Sources */, + 2C53DAA62AF866B200EB233F /* AnyBaseConverter.swift in Sources */, 2CCE3EAD2AF67A9000BB0ED3 /* UtilsFunctions.swift in Sources */, 2CCE3EB12AF67CFD00BB0ED3 /* HexaConverter.swift in Sources */, - 2CCE3EB52AF6879200BB0ED3 /* OctalConverter.swift in Sources */, 2CCE3E9F2AF678B200BB0ED3 /* BinaryConverterApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/BinaryConverter/AnyBaseConverter.swift b/BinaryConverter/AnyBaseConverter.swift new file mode 100644 index 0000000..2a7a9a4 --- /dev/null +++ b/BinaryConverter/AnyBaseConverter.swift @@ -0,0 +1,48 @@ +// +// AnyBaseConverter.swift +// BinaryConverter +// +// Created by Louis Gallet on 06/11/2023. +// + +import SwiftUI + +struct AnyBaseConverter: View { + @State private var sourceBasedNumber: String = "" + @State private var basedNumber: String = "" + @State private var destinationBasedNumber: String = "" + @State private var resultConversion: String = "" + var body: some View { + Form { + Section(header: Text("Source base")) { + TextField("Enter the source base for the number", text: $sourceBasedNumber) + .keyboardType(.numberPad) + } + Section(header: Text("Number to convert")) { + TextField("Enter the number that you want to convert", + text: $basedNumber) + .keyboardType(.numberPad) + } + Section(header: Text("Destination base")) { + TextField("Enter the arrival base", + text: $destinationBasedNumber) + .keyboardType(.numberPad) + } + Section(header: Text("Result")) { + Text("Your number in base \(destinationBasedNumber): \(resultConversion)") + } + Button("Dismiss Keyboard") { + UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) + } + } + .onChange(of: $basedNumber, $sourceBasedNumber) { newValue in resultConversion = convertFromAnyBaseToAnyBase(basedNumber, fromBase: Int(sourceBasedNumber)!, toBase: Int(destinationBasedNumber))!} +// .onChange(of: $sourceBasedNumber) { newValue in +// $destinationBasedNumber = convertToHex(newValue) +// } + + } +} + +#Preview { + AnyBaseConverter() +} diff --git a/BinaryConverter/OctalConverter.swift b/BinaryConverter/OctalConverter.swift deleted file mode 100644 index 589d006..0000000 --- a/BinaryConverter/OctalConverter.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// OctalConverter.swift -// BinaryConverter -// -// Created by Louis Gallet on 04/11/2023. -// - -import SwiftUI - -struct OctalConverter: View { - var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) - } -} - -#Preview { - OctalConverter() -} diff --git a/BinaryConverter/UtilsFunctions.swift b/BinaryConverter/UtilsFunctions.swift index 3ecc3f8..fab95f1 100644 --- a/BinaryConverter/UtilsFunctions.swift +++ b/BinaryConverter/UtilsFunctions.swift @@ -29,3 +29,17 @@ func convertToHex(_ decimalString: String) -> String { return "Invalid Input" } } + +/// Converts a number from the source base to the destination base +/// - Parameters: +/// - decimalString: The number that you want to convert +/// - fromBase: The base of the number that you want to convert +/// - toBase: The destination base +/// - Returns: Return the number in toBase base or return "Invalid Input" if the input is not valid +func convertFromAnyBaseToAnyBase(_ decimalString: String, fromBase: Int, toBase: Int) -> String { + if let number = Int(decimalString, radix: fromBase) { + return String(number, radix: toBase) + } else { + return "Invalid Input" + } +} From 2571fb29a3621492fe3a5a3a86eebc99791d8f1f Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 8 Nov 2023 17:20:14 +0100 Subject: [PATCH 2/4] feat: :construction: Starting conversion from any base to another --- BinaryConverter.xcodeproj/project.pbxproj | 4 ++-- .../xcdebugger/Breakpoints_v2.xcbkptlist | 6 +++++ BinaryConverter/AnyBaseConverter.swift | 22 +++++++++++-------- BinaryConverter/ContentView.swift | 1 + 4 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 BinaryConverter.xcodeproj/xcuserdata/louisgallet.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist diff --git a/BinaryConverter.xcodeproj/project.pbxproj b/BinaryConverter.xcodeproj/project.pbxproj index 6dec7d8..1a69a75 100644 --- a/BinaryConverter.xcodeproj/project.pbxproj +++ b/BinaryConverter.xcodeproj/project.pbxproj @@ -302,7 +302,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = fr.louisgallet.BinaryConverter; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -336,7 +336,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = fr.louisgallet.BinaryConverter; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/BinaryConverter.xcodeproj/xcuserdata/louisgallet.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/BinaryConverter.xcodeproj/xcuserdata/louisgallet.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..d934828 --- /dev/null +++ b/BinaryConverter.xcodeproj/xcuserdata/louisgallet.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/BinaryConverter/AnyBaseConverter.swift b/BinaryConverter/AnyBaseConverter.swift index 2a7a9a4..ad2e0dc 100644 --- a/BinaryConverter/AnyBaseConverter.swift +++ b/BinaryConverter/AnyBaseConverter.swift @@ -18,16 +18,18 @@ struct AnyBaseConverter: View { TextField("Enter the source base for the number", text: $sourceBasedNumber) .keyboardType(.numberPad) } - Section(header: Text("Number to convert")) { - TextField("Enter the number that you want to convert", - text: $basedNumber) - .keyboardType(.numberPad) - } Section(header: Text("Destination base")) { TextField("Enter the arrival base", text: $destinationBasedNumber) .keyboardType(.numberPad) } + + Section(header: Text("Number to convert")) { + TextField("Enter the number that you want to convert", + text: $basedNumber) + .keyboardType(.numberPad) + } + Section(header: Text("Result")) { Text("Your number in base \(destinationBasedNumber): \(resultConversion)") } @@ -35,10 +37,12 @@ struct AnyBaseConverter: View { UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) } } - .onChange(of: $basedNumber, $sourceBasedNumber) { newValue in resultConversion = convertFromAnyBaseToAnyBase(basedNumber, fromBase: Int(sourceBasedNumber)!, toBase: Int(destinationBasedNumber))!} -// .onChange(of: $sourceBasedNumber) { newValue in -// $destinationBasedNumber = convertToHex(newValue) -// } + .onChange(of: basedNumber) { newValue in + if (!(destinationBasedNumber == "" || sourceBasedNumber == "")) { + resultConversion = convertFromAnyBaseToAnyBase(basedNumber, fromBase: Int(sourceBasedNumber)!, toBase: Int(destinationBasedNumber) ?? 0) + } + + } } } diff --git a/BinaryConverter/ContentView.swift b/BinaryConverter/ContentView.swift index 5c8080b..b65e100 100644 --- a/BinaryConverter/ContentView.swift +++ b/BinaryConverter/ContentView.swift @@ -14,6 +14,7 @@ struct ContentView: View { content: { BinaryConverter().tabItem { Image(systemName: "2.square.fill") ; Text("Binary") }.tag(0) HexaConverter().tabItem { Image(systemName: "16.square.fill") ; Text("Hexa") }.tag(1) + AnyBaseConverter().tabItem { Image(systemName: "number.square.fill") ; Text("Any base") }.tag(2) }) } From 80a0bf1bd5156a439f916a3a08b1f560e7e032f1 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 8 Nov 2023 17:52:58 +0100 Subject: [PATCH 3/4] feat: :sparkles: Add contextual menu for copy-paste --- BinaryConverter.xcodeproj/project.pbxproj | 8 ++++---- BinaryConverter/AnyBaseConverter.swift | 8 ++++++++ BinaryConverter/BinaryConverter.swift | 8 ++++++++ BinaryConverter/HexaConverter.swift | 9 +++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/BinaryConverter.xcodeproj/project.pbxproj b/BinaryConverter.xcodeproj/project.pbxproj index 1a69a75..87366b4 100644 --- a/BinaryConverter.xcodeproj/project.pbxproj +++ b/BinaryConverter.xcodeproj/project.pbxproj @@ -13,8 +13,8 @@ 2CCE3EA32AF678B300BB0ED3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2CCE3EA22AF678B300BB0ED3 /* Assets.xcassets */; }; 2CCE3EA62AF678B300BB0ED3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2CCE3EA52AF678B300BB0ED3 /* Preview Assets.xcassets */; }; 2CCE3EAD2AF67A9000BB0ED3 /* UtilsFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */; }; - 2CCE3EAF2AF67BA900BB0ED3 /* BinaryConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */; }; 2CCE3EB12AF67CFD00BB0ED3 /* HexaConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */; }; + 2CEC5C712AFBF09800A6DEB3 /* BinaryConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEC5C702AFBF09800A6DEB3 /* BinaryConverter.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -25,8 +25,8 @@ 2CCE3EA22AF678B300BB0ED3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 2CCE3EA52AF678B300BB0ED3 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilsFunctions.swift; sourceTree = ""; }; - 2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryConverter.swift; sourceTree = ""; }; 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexaConverter.swift; sourceTree = ""; }; + 2CEC5C702AFBF09800A6DEB3 /* BinaryConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BinaryConverter.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -62,7 +62,7 @@ 2CCE3E9E2AF678B200BB0ED3 /* BinaryConverterApp.swift */, 2CCE3EA02AF678B200BB0ED3 /* ContentView.swift */, 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */, - 2CCE3EAE2AF67BA900BB0ED3 /* BinaryConverter.swift */, + 2CEC5C702AFBF09800A6DEB3 /* BinaryConverter.swift */, 2C53DAA52AF866B200EB233F /* AnyBaseConverter.swift */, 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */, 2CCE3EA22AF678B300BB0ED3 /* Assets.xcassets */, @@ -150,9 +150,9 @@ buildActionMask = 2147483647; files = ( 2CCE3EA12AF678B200BB0ED3 /* ContentView.swift in Sources */, - 2CCE3EAF2AF67BA900BB0ED3 /* BinaryConverter.swift in Sources */, 2C53DAA62AF866B200EB233F /* AnyBaseConverter.swift in Sources */, 2CCE3EAD2AF67A9000BB0ED3 /* UtilsFunctions.swift in Sources */, + 2CEC5C712AFBF09800A6DEB3 /* BinaryConverter.swift in Sources */, 2CCE3EB12AF67CFD00BB0ED3 /* HexaConverter.swift in Sources */, 2CCE3E9F2AF678B200BB0ED3 /* BinaryConverterApp.swift in Sources */, ); diff --git a/BinaryConverter/AnyBaseConverter.swift b/BinaryConverter/AnyBaseConverter.swift index ad2e0dc..cbd5587 100644 --- a/BinaryConverter/AnyBaseConverter.swift +++ b/BinaryConverter/AnyBaseConverter.swift @@ -32,6 +32,14 @@ struct AnyBaseConverter: View { Section(header: Text("Result")) { Text("Your number in base \(destinationBasedNumber): \(resultConversion)") + .contextMenu(ContextMenu(menuItems: { + Button(action: { + let pasteboard = UIPasteboard.general + pasteboard.string = resultConversion + }, label: { + Label("Copy value", systemImage: "doc.on.doc") + }) + })) } Button("Dismiss Keyboard") { UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) diff --git a/BinaryConverter/BinaryConverter.swift b/BinaryConverter/BinaryConverter.swift index 7a45db8..bc10c8b 100644 --- a/BinaryConverter/BinaryConverter.swift +++ b/BinaryConverter/BinaryConverter.swift @@ -18,6 +18,14 @@ struct BinaryConverter: View { } Section(header: Text("Base 2")) { Text("Your number in base 2: \(binaryNumber)") + .contextMenu(ContextMenu(menuItems: { + Button(action: { + let pasteboard = UIPasteboard.general + pasteboard.string = binaryNumber + }, label: { + Label("Copy value", systemImage: "doc.on.doc") + }) + })) } Button("Dismiss Keyboard") { UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) diff --git a/BinaryConverter/HexaConverter.swift b/BinaryConverter/HexaConverter.swift index 9bfcbcd..d358896 100644 --- a/BinaryConverter/HexaConverter.swift +++ b/BinaryConverter/HexaConverter.swift @@ -18,6 +18,15 @@ struct HexaConverter: View { } Section(header: Text("Base 16")) { Text("Your number in base 16: \(HexadecimalNumber)") + .contextMenu(ContextMenu(menuItems: { + Button(action: { + let pasteboard = UIPasteboard.general + pasteboard.string = HexadecimalNumber + + }, label: { + Label("Copy value", systemImage: "doc.on.doc") + }) + })) } Button("Dismiss Keyboard") { UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) From 319196e8890934dc989a7a910f7d5984878fb7ff Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 8 Nov 2023 18:09:33 +0100 Subject: [PATCH 4/4] style: :globe_with_meridians: Create french trasnlation --- BinaryConverter.xcodeproj/project.pbxproj | 5 + BinaryConverter/ContentView.swift | 4 +- BinaryConverter/Localizable.xcstrings | 347 ++++++++++++++++++++++ 3 files changed, 354 insertions(+), 2 deletions(-) create mode 100644 BinaryConverter/Localizable.xcstrings diff --git a/BinaryConverter.xcodeproj/project.pbxproj b/BinaryConverter.xcodeproj/project.pbxproj index 87366b4..3cfd29b 100644 --- a/BinaryConverter.xcodeproj/project.pbxproj +++ b/BinaryConverter.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 2CCE3EAD2AF67A9000BB0ED3 /* UtilsFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */; }; 2CCE3EB12AF67CFD00BB0ED3 /* HexaConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */; }; 2CEC5C712AFBF09800A6DEB3 /* BinaryConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEC5C702AFBF09800A6DEB3 /* BinaryConverter.swift */; }; + 2CEC5C752AFBF5BB00A6DEB3 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 2CEC5C742AFBF5BB00A6DEB3 /* Localizable.xcstrings */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -27,6 +28,7 @@ 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilsFunctions.swift; sourceTree = ""; }; 2CCE3EB02AF67CFD00BB0ED3 /* HexaConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexaConverter.swift; sourceTree = ""; }; 2CEC5C702AFBF09800A6DEB3 /* BinaryConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BinaryConverter.swift; sourceTree = ""; }; + 2CEC5C742AFBF5BB00A6DEB3 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,6 +67,7 @@ 2CEC5C702AFBF09800A6DEB3 /* BinaryConverter.swift */, 2C53DAA52AF866B200EB233F /* AnyBaseConverter.swift */, 2CCE3EAC2AF67A9000BB0ED3 /* UtilsFunctions.swift */, + 2CEC5C742AFBF5BB00A6DEB3 /* Localizable.xcstrings */, 2CCE3EA22AF678B300BB0ED3 /* Assets.xcassets */, 2CCE3EA42AF678B300BB0ED3 /* Preview Content */, ); @@ -121,6 +124,7 @@ knownRegions = ( en, Base, + fr, ); mainGroup = 2CCE3E922AF678B200BB0ED3; productRefGroup = 2CCE3E9C2AF678B200BB0ED3 /* Products */; @@ -139,6 +143,7 @@ files = ( 2CCE3EA62AF678B300BB0ED3 /* Preview Assets.xcassets in Resources */, 2CCE3EA32AF678B300BB0ED3 /* Assets.xcassets in Resources */, + 2CEC5C752AFBF5BB00A6DEB3 /* Localizable.xcstrings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/BinaryConverter/ContentView.swift b/BinaryConverter/ContentView.swift index b65e100..c71df7b 100644 --- a/BinaryConverter/ContentView.swift +++ b/BinaryConverter/ContentView.swift @@ -12,8 +12,8 @@ struct ContentView: View { var body: some View { TabView(selection: $selectedTab, content: { - BinaryConverter().tabItem { Image(systemName: "2.square.fill") ; Text("Binary") }.tag(0) - HexaConverter().tabItem { Image(systemName: "16.square.fill") ; Text("Hexa") }.tag(1) + BinaryConverter().tabItem { Image(systemName: "2.square.fill") ; Text("menu.conversion.binary") }.tag(0) + HexaConverter().tabItem { Image(systemName: "16.square.fill") ; Text("menu.conversion.hexa") }.tag(1) AnyBaseConverter().tabItem { Image(systemName: "number.square.fill") ; Text("Any base") }.tag(2) }) diff --git a/BinaryConverter/Localizable.xcstrings b/BinaryConverter/Localizable.xcstrings new file mode 100644 index 0000000..19d73cb --- /dev/null +++ b/BinaryConverter/Localizable.xcstrings @@ -0,0 +1,347 @@ +{ + "sourceLanguage" : "en", + "strings" : { + "Any base" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Any base" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Toutes bases" + } + } + } + }, + "Base 2" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base 2" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base 2" + } + } + } + }, + "Base 10" : { + "comment" : "Same translation", + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base 10" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base 10" + } + } + } + }, + "Base 16" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base 16" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base 16" + } + } + } + }, + "Binary" : { + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Binary" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Binaire" + } + } + } + }, + "Copy value" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Copy value" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Copier la valeur" + } + } + } + }, + "Destination base" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Destination base" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base de destination" + } + } + } + }, + "Dismiss Keyboard" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Dismiss Keyboard" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Fermer le clavier" + } + } + } + }, + "Enter the arrival base" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Enter the arrival base" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Entrer la base d'arrivée" + } + } + } + }, + "Enter the base 10 number here" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Enter the base 10 number here" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Entrez le nombre en base 10 ici" + } + } + } + }, + "Enter the number that you want to convert" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Enter the number that you want to convert" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Entrez le nombre à convertir" + } + } + } + }, + "Enter the source base for the number" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Enter the source base for the number" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Entrez la base source" + } + } + } + }, + "Hexa" : { + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Hexa" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Hexa" + } + } + } + }, + "menu.conversion.binary" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Binary" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Binaire" + } + } + } + }, + "menu.conversion.hexa" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Hexa" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Hexadecimal" + } + } + } + }, + "Number to convert" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Number to convert" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Le nombre à convertir" + } + } + } + }, + "Result" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Result" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Résultat" + } + } + } + }, + "Source base" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Source base" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Base source" + } + } + } + }, + "Your number in base %@: %@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Your number in base %1$@: %2$@" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Votre nombre en base %1$@: %2$@" + } + } + } + }, + "Your number in base 2: %@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Your number in base 2: %@" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Votre nombre en base 2: %@" + } + } + } + }, + "Your number in base 16: %@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Your number in base 16: %@" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Votre nombre en base 16: %@" + } + } + } + } + }, + "version" : "1.0" +} \ No newline at end of file