EngageSolutionsGroup.Apple.MLKitTranslate
3.2.0
The framework is not signed which results in rejection in Apple store
See the version list below for details.
dotnet add package EngageSolutionsGroup.Apple.MLKitTranslate --version 3.2.0
NuGet\Install-Package EngageSolutionsGroup.Apple.MLKitTranslate -Version 3.2.0
<PackageReference Include="EngageSolutionsGroup.Apple.MLKitTranslate" Version="3.2.0" />
paket add EngageSolutionsGroup.Apple.MLKitTranslate --version 3.2.0
#r "nuget: EngageSolutionsGroup.Apple.MLKitTranslate, 3.2.0"
// Install EngageSolutionsGroup.Apple.MLKitTranslate as a Cake Addin #addin nuget:?package=EngageSolutionsGroup.Apple.MLKitTranslate&version=3.2.0 // Install EngageSolutionsGroup.Apple.MLKitTranslate as a Cake Tool #tool nuget:?package=EngageSolutionsGroup.Apple.MLKitTranslate&version=3.2.0
iOS Google ML Kit Translate - .NET Binding
This repository provides a .NET iOS binding for the GoogleMLKit/Translate library, enabling the use of Google ML Kit's translation capabilities in .NET iOS applications.
Features
- Language Translation: Translate text between supported languages.
Limitations
iOS Simulator Architecture Issue
Due to an issue with the Google ML Kit library not supporting the arm64
architecture for iOS simulators, you need to configure your project to build for the x64
architecture when targeting the iOS simulator. This is necessary to avoid build errors when running the application on an iOS simulator.
For more details on this issue, you can refer to the official issue on the Google issue tracker: Issue 178965151 - iOS Simulator arm64 not supported.
Configuring the Project for iOS Simulator
To ensure that your project builds correctly for the iOS simulator, add the following setting to your .csproj
file:
<PropertyGroup>
<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>
Prerequisites
- Xcode: Ensure you have the latest version of Xcode installed.
- .NET 8.0 or later: This binding is designed for use with .NET 8.0 or later.
- Cocoapods: Used to download Google ML Kit for translation and its depedencies.
Steps to Generate the NuGet Package
1. Prepare the Native Library
The binding project depends on the native GoogleMLKit/Translate library. You must build the xcframework
s from the native project using CocoaPods and a custom build script.
a. Navigate to the Native Project Directory
Open your terminal and navigate to the native/EngageMLKit
directory:
cd native/EngageMLKit
b. Install CocoaPods Dependencies
Run the following command to install the required dependencies:
pod install
c. Build the xcframework
Execute the build.sh script to generate the xcframework:
sh ./build.sh
The generated xcframework will be available in the native/EngageMLKit/build directory.
2. Test API bindings
Open MLKitBindingTestApp.sln and launch on device/simulator
Usage
var stringSource = "Hello how are you, My name is Yana and I am 19 years old?"
var options = new MLKTranslatorOptions(Constants.MLKTranslateLanguageEnglish, Constants.MLKTranslateLanguageUkrainian);
MLKTranslatorDownloadModelIfNeededCallback callback = (error) => {
if (error != null)
{
Console.WriteLine($"Error: {error}");
return;
}
Console.WriteLine("Downloaded model");
translator.TranslateText(stringSource, (result, error) => {
if (error != null)
{
Console.WriteLine($"Error: {error}");
return;
}
Console.WriteLine($"Result: {result}");
});
};
translator = MLKTranslator.TranslatorWithOptions(options);
translator.DownloadModelIfNeededWithCompletion(callback);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-ios17.5 is compatible. |
-
net8.0-ios17.5
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.