### Install deepl-php using Composer Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Installs the deepl-php library into your project using Composer, the dependency manager for PHP. ```shell composer require deeplcom/deepl-php ``` -------------------------------- ### DeepL PHP Document Translation Example Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Demonstrates how to translate a document from English to German using the DeepL PHP client. Includes error handling for potential translation issues, specifically addressing document upload and retrieval. ```php // Translate a formal document from English to German: try { $deeplClient->translateDocument( 'Instruction Manual.docx', 'Bedienungsanleitung.docx', 'en', 'de', ['formality' => 'more'], ); } catch (DeepLDocumentTranslationException $error) { // If the error occurs after the document was already uploaded, // documentHandle will contain the document ID and key echo 'Error occurred while translating document: ' . ($error->getMessage() ?? 'unknown error'); if ($error->documentHandle) { $handle = $error->documentHandle; echo "Document ID: {$handle->documentId}, document key: {$handle->documentKey}"; } else { echo 'Unknown document handle'; } } ``` -------------------------------- ### Get Glossary Entries (Monolingual and Multilingual) Source: https://github.com/deeplcom/deepl-php/blob/main/upgrading_to_multilingual_glossaries.md Retrieves entries from a Deepl glossary. Supports both monolingual and multilingual glossaries, demonstrating how to access the returned entries. ```php // monolingual glossary example $glossaryId = '559192ed-8e23-...'; $entries = $deeplClient->getGlossaryEntries($myGlossary); print_r($entries->getEntries()); // Array ( [artist] => Maler, [prize] => Gewinn) // multilingual glossary example $glossaryId = '559192ed-8e23-...'; $glossaryDicts = $deeplClient->getMultilingualGlossaryEntries($myGlossary, "en", "de"); print_r($glossaryDicts[0]->getEntries()); // Array ( [artist] => Maler, [prize] => Gewinn) ``` -------------------------------- ### Get Glossary (Monolingual vs. Multilingual) Source: https://github.com/deeplcom/deepl-php/blob/main/upgrading_to_multilingual_glossaries.md Shows how to retrieve a glossary using both the v2 and v3 API methods. The v2 method returns a GlossaryInfo object, while the v3 method returns a MultilingualGlossaryInfo object. ```php // monolingual glossary example $glossaryId = '559192ed-8e23-...'; $myGlossary = $deeplClient->getGlossary($glossaryId); // GlossaryInfo object ``` ```php // multilingual glossary example $glossaryId = '559192ed-8e23-...'; $myGlossary = $deeplClient->getMultilingualGlossary($glossaryId); // MultilingualGlossaryInfo object ``` -------------------------------- ### Initialize DeepLClient and Translate Text Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Demonstrates how to create a DeepLClient instance with an authentication key and perform a basic text translation from English to French. ```php $authKey = "f63c02c5-f056-..."; // Replace with your key $deeplClient = new \DeepL\DeepLClient($authKey); $result = $deeplClient->translateText('Hello, world!', null, 'fr'); echo $result->text; // Bonjour, le monde! ``` -------------------------------- ### Configure Proxy Server Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Sets up a proxy server for the DeepL client by providing the proxy URL during client initialization. ```php $proxy = 'http://user:pass@10.10.1.10:3128'; $deeplClient = new DeepLDeepLClient('YOUR_AUTH_KEY', ['proxy' => $proxy]); ``` -------------------------------- ### Initialize DeepLClient with Platform Info Disabled Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Demonstrates how to create a DeepLClient instance while disabling the sending of anonymous platform information by setting `send_platform_info` to false. ```php $deeplClient = new \DeepL\DeepLClient('YOUR_AUTH_KEY', ['send_platform_info' => false]); ``` -------------------------------- ### Create Glossary (Monolingual vs. Multilingual) Source: https://github.com/deeplcom/deepl-php/blob/main/upgrading_to_multilingual_glossaries.md Demonstrates how to create a monolingual glossary using the v2 method and a multilingual glossary using the new v3 method. The v3 method accepts an array of MultilingualGlossaryDictionaryEntries. ```php // monolingual glossary example $entries = GlossaryEntries::fromEntries(['artist' => 'Maler', 'prize' => 'Gewinn']); $myGlossary = $deeplClient->createGlossary('My glossary', 'en', 'de', $entries); ``` ```php // multilingual glossary example $entries = GlossaryEntries::fromEntries(['artist' => 'Maler', 'prize' => 'Gewinn']); $myGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $entries); $myGlossary = $deeplClient->createMultilingualGlossary('My glossary', [$myGlossaryDict]); ``` -------------------------------- ### DeepL Glossary API Overview Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Provides an overview of the DeepL glossary APIs, highlighting the differences between v2 and v3 endpoints. It recommends using the v3 multilingual glossary methods for enhanced functionality, including editing and multilingual support. ```APIDOC Glossary APIs: Overview: Glossaries allow customization of translations with user-defined terms. Multiple glossaries can be stored per account, each with a name and ID. v2 vs. v3: - v3 endpoints offer editing and multilingual glossary support. - v2 endpoints (e.g., createGlossary(), getGlossary()) remain for existing users. - Migration to v3 is recommended for new functionality. Multilingual Glossary Methods (v3): - Refer to the migration guide for transitioning from v2 to v3. - This section details interaction with multilingual glossaries using the new v3 functionality. ``` -------------------------------- ### Initialize DeepLClient with Custom Headers Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Shows how to initialize the DeepLClient with custom HTTP headers, including overriding the User-Agent, by providing a 'headers' array in the options. ```php $headers = [ 'Authorization' => "DeepL-Auth-Key YOUR_AUTH_KEY", 'User-Agent' => 'my-custom-php-client', ]; $deeplClient = new \DeepL\DeepLClient('YOUR_AUTH_KEY', ['headers' => $headers]); ``` -------------------------------- ### Identify Application with AppInfo Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Configures the DeepL client to identify your application by providing its name and version using the AppInfo option. ```php $options = ['app_info' => new DeepLAppInfo('my-custom-php-chat-client', '1.2.3')]; $deeplClient = new DeepLDeepLClient('YOUR_AUTH_KEY', $options); ``` -------------------------------- ### Configure DeepL Client Options Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Initializes the DeepL client with custom configuration options, including maximum retries and request timeout. ```php $options = [ 'max_retries' => 5, 'timeout' => 10.0 ]; $deeplClient = new DeepLDeepLClient('YOUR_AUTH_KEY', $options); ``` -------------------------------- ### Initialize DeepLClient with Custom Guzzle HTTP Client Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Illustrates configuring the DeepLClient to use a custom PSR-18 compliant HTTP client, specifically Guzzle, with custom timeouts and proxy settings. ```php $client = new \GuzzleHttp\Client([ 'connect_timeout' => 5.2, 'read_timeout' => 7.4, 'proxy' => 'http://localhost:8125' ]); $deeplClient = new \DeepL\DeepLClient('YOUR_AUTH_KEY', [DeepLClientOptions::HTTP_CLIENT => $client]); $deeplClient->getUsage(); // Or a translate call, etc ``` -------------------------------- ### DeepL PHP Document Translation Options Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Details the optional parameters for the `translateDocument` function, including formality, glossary, and minification settings. ```APIDOC translateDocument(string $sourceFile, string $targetFile, string $sourceLang, string $targetLang, array $options = []): - Translates a document from one language to another. - Parameters: - sourceFile: Path to the input document. - targetFile: Path for the translated document. - sourceLang: Source language code. - targetLang: Target language code. - options: An associative array of document translation options. - formality: Sets the formality of the translation. Same values as in Text translation options. - glossary: Specifies a glossary to use for the translation. - minification: If set to `true`, the library attempts to minify the document before translation (only for pptx files). - Note: `minification` option only works with the high-level `translateDocument` method. - Constants for options are available in `TranslateDocumentOptions` class, e.g., `TranslateDocumentOptions::FORMALITY`. ``` -------------------------------- ### List and Delete Glossaries (Monolingual and Multilingual) Source: https://github.com/deeplcom/deepl-php/blob/main/upgrading_to_multilingual_glossaries.md Demonstrates how to list all available glossaries and subsequently delete a specific glossary by its name. Supports both monolingual and multilingual glossary management. ```php // monolingual glossary example $glossaries = $deeplClient->listGlossaries(); foreach ($glossaries as $glossary) { if ($glossary->name === 'Old glossary') { $deeplClient->deleteGlossary($glossary); } } // multilingual glossary example $glossaries = $deeplClient->listMultilingualGlossaries(); foreach ($glossaries as $glossary) { if ($glossary->name === 'Old glossary') { $deeplClient->deleteMultilingualGlossary($glossary); } } ``` -------------------------------- ### Translate Text with Formality Options Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Illustrates how to use the `formality` option when translating text to German, demonstrating both 'less' and 'more' formality levels. ```php // Translate into German with less and more Formality: echo $deeplClient->translateText('How are you?', null, 'de', ['formality' => 'less']); // 'Wie geht es dir?' echo $deeplClient->translateText('How are you?', null, 'de', ['formality' => 'more']); // 'Wie geht es Ihnen?' ``` -------------------------------- ### List Glossary Language Pairs Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Fetches and displays the source and target language codes for which glossaries are supported. ```php $glossaryLanguages = $deeplClient->getGlossaryLanguages(); foreach ($glossaryLanguages as $glossaryLanguage) { echo "$glossaryLanguage->sourceLang to $glossaryLanguage->targetLang"; // Example: "en to de", "de to en", etc. } ``` -------------------------------- ### Enable Logging with PSR-3 Logger Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Configures the DeepL client to use a PSR-3 compatible logger for outputting messages. ```php $deeplClient = new DeepLDeepLClient('YOUR_AUTH_KEY', ['logger' => $psr3Logger]); ``` -------------------------------- ### Translate Document with Glossary Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Illustrates how to use a stored glossary for document translation, specifying the glossary and source language. ```php $deeplClient->translateDocument( $inFile, $outFile, 'en', 'de', ['glossary' => $myGlossary] ) ``` -------------------------------- ### Create Multilingual Glossary Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Creates a multilingual glossary with specified terms for a given source-target language pair. It returns MultilingualGlossaryInfo upon success. ```php use DeepL\GlossaryEntries; use DeepL\MultilingualGlossaryDictionaryEntries; // Create an English to German glossary with two terms: $entries = GlossaryEntries::fromEntries(['artist' => 'Maler', 'prize' => 'Gewinn']); $myGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $entries); $myGlossary = $deeplClient->createMultilingualGlossary('My glossary', [$myGlossaryDict]); echo "Created '$myGlossary->name' ($myGlossary->glossaryId) " . "with a dictionary from $myGlossary->dictionaries[0]->sourceLang to " . "$myGlossary->dictionaries[0]->targetLang containing " . "$myGlossary->dictionaries[0]->entryCount entries"; // Example: Created 'My glossary' (559192ed-8e23-...) with a dictionary from en to de containing 2 entries ``` -------------------------------- ### Create Multilingual Glossary from CSV Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Creates a multilingual glossary by uploading a CSV file. It requires the glossary name, source and target language codes, and the CSV data as a string. ```php // Read CSV data from a file, for example: "artist,Maler,en,de\nprize,Gewinn,en,de" $csvData = file_get_contents('/path/to/glossary_file.csv'); $myCsvGlossary = $deeplClient->createMultilingualGlossaryFromCsv( 'CSV glossary', 'en', 'de', $csvData, ); ``` -------------------------------- ### List Source and Target Languages Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Retrieves and displays the names and codes of supported source and target languages. For target languages, it also indicates if formality is supported. ```php $sourceLanguages = $deeplClient->getSourceLanguages(); foreach ($sourceLanguages as $sourceLanguage) { echo $sourceLanguage->name . ' (' . $sourceLanguage->code . ')'; // Example: 'English (en)' } $targetLanguages = $deeplClient->getTargetLanguages(); foreach ($targetLanguages as $targetLanguage) { if ($targetLanguage->supportsFormality) { echo $targetLanguage->name . ' (' . $targetLanguage->code . ') supports formality'; // Example: 'German (de) supports formality' } } ``` -------------------------------- ### Enable Document Minification in PHP Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Demonstrates how to enable document minification when translating documents using the DeepL PHP client. This feature helps reduce file size by replacing media with placeholders during translation. ```php $deeplClient->translateDocument( $inFile, $outFile, 'en', 'de', [TranslateDocumentOptions::ENABLE_DOCUMENT_MINIFICATION => true] ); ``` -------------------------------- ### Run Code Style Checks and Fixes Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Commands to execute PHP CodeSniffer (phpcs) for checking code style and PHP Code Beautifier (phpcbf) for automatically fixing style issues. ```bash ./vendor/bin/phpcbf ./vendor/bin/phpcs ``` -------------------------------- ### Check Account Usage Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Demonstrates how to retrieve and interpret account usage information, including character and document translation limits. ```php $usage = $deeplClient->getUsage(); if ($usage->anyLimitReached()) { echo 'Translation limit exceeded.'; } if ($usage->character) { echo 'Characters: ' . $usage->character->count . ' of ' . $usage->character->limit; } if ($usage->document) { echo 'Documents: ' . $usage->document->count . ' of ' . $usage->document->limit; } ``` -------------------------------- ### Translate Text with Glossary Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Shows how to use a stored glossary to improve translation accuracy for text. It compares the output with and without a glossary. ```php $text = 'The artist was awarded a prize.'; $withGlossary = $deeplClient->translateText($text, 'en', 'de', ['glossary' => $myGlossary]); echo $withGlossary->text; // "Der Maler wurde mit einem Gewinn ausgezeichnet." // For comparison, the result without a glossary: $withoutGlossary = $deeplClient->translateText($text, null, 'de'); echo $withoutGlossary->text; // "Der Künstler wurde mit einem Preis ausgezeichnet." ``` -------------------------------- ### DeepL PHP Document Translation Functions Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Lists the individual functions used by `translateDocument` for uploading, checking status, and downloading documents. ```APIDOC uploadDocument(string $sourceFile, array $options = []): - Uploads a document for translation. - Parameters: - sourceFile: Path to the input document. - options: An associative array of upload options (e.g., formality, glossary). - Returns: Document handle containing document ID and key. waitUntilDocumentTranslationComplete(DocumentHandle $documentHandle): - Waits until the document translation is complete. - Parameters: - documentHandle: The handle returned by `uploadDocument`. downloadDocument(DocumentHandle $documentHandle, string $targetFile): - Downloads the translated document. - Parameters: - documentHandle: The handle returned by `uploadDocument`. - targetFile: Path for the translated document. ``` -------------------------------- ### DeepL PHP Rephrasing Options Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Details the available options for the `rephraseText` function in the DeepL PHP client, focusing on `writing_style` and `tone` parameters. ```APIDOC rephraseText(string $text, string $targetLang, array $options = []): - Rephrases the given text. - Parameters: - text: The text to rephrase. - targetLang: The target language code. - options: An associative array of rephrasing options. - writing_style: Sets the style for the rephrased text. Possible values: - 'academic': Academic writing style - 'business': Business writing style - 'casual': Casual writing style - 'default': Default writing style - 'simple': Simple writing style - 'prefer_academic': Use academic style if available, otherwise default - 'prefer_business': Use business style if available, otherwise default - 'prefer_casual': Use casual style if available, otherwise default - 'prefer_simple': Use simple style if available, otherwise default - tone: Sets the tone for the rephrased text. Possible values: - 'confident': Confident tone - 'default': Default tone - 'diplomatic': Diplomatic tone - 'enthusiastic': Enthusiastic tone - 'friendly': Friendly tone - 'prefer_confident': Use confident tone if available, otherwise default - 'prefer_diplomatic': Use diplomatic tone if available, otherwise default - 'prefer_enthusiastic': Use enthusiastic tone if available, otherwise default - 'prefer_friendly': Use friendly tone if available, otherwise default - Note: Only one of 'writing_style' or 'tone' can be specified at a time. - Constants for options are available in `DeepLClientOptions` class, e.g., `RephraseTextOptions::WRITING_STYLE`. ``` -------------------------------- ### Update and Replace Multilingual Glossary Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Demonstrates how to update existing entries or add new ones to a multilingual glossary, and how to completely replace a glossary dictionary for a specific language pair. ```php // Update glossary $entries = GlossaryEntries::fromEntries(['artist' => 'Maler', 'hello' => 'guten tag']); $myGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $entries); $myGlossary = $deeplClient->createMultilingualGlossary('My glossary', [$myGlossaryDict]); $newEntries = GlossaryEntries::fromEntries(['hello' => 'hallo', 'prize' => 'Gewinn']); $myUpdatedGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $newEntries); $myUpdatedGlossary = $deeplClient->updateMultilingualGlossary( $myGlossary, 'My updated glossary', [$myUpdatedGlossaryDict]); print_r($myUpdatedGlossary->dictionaries[0]->getEntries()); // Array ( [artist] => Maler, [hello] => hallo, [prize] => Gewinn) // Replace glossary dictionary $entries = GlossaryEntries::fromEntries(['artist' => 'Maler', 'hello' => 'guten tag']); $myGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $entries); $myGlossary = $deeplClient->createMultilingualGlossary('My glossary', [$myGlossaryDict]); $newEntries = GlossaryEntries::fromEntries(['hello' => 'hallo', 'prize' => 'Gewinn']); $myUpdatedGlossaryDictEntries = new MultilingualGlossaryDictionaryEntries('en', 'de', $newEntries); $myNewGlossaryDict = $deeplClient->replaceMultilingualGlossaryDictionary( $myGlossary, $myUpdatedGlossaryDict); print_r($myNewGlossaryDict->entries->getEntries()); // Array ( [hello] => hallo, [prize] => Gewinn) ``` -------------------------------- ### List Glossary Entries Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Retrieves the entries contained within a stored glossary. It requires the glossary identifier and language pair, returning an array of glossary entries. ```php $glossaryDicts = $deeplClient->getMultilingualGlossaryEntries($myGlossary, "en", "de"); print_r($glossaryDicts[0]->getEntries()); // Array ( [artist] => Maler, [prize] => Gewinn) ``` -------------------------------- ### Rephrasing Text with DeepL PHP Client Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Demonstrates how to rephrase single or multiple text inputs using the DeepL PHP client. It covers rephrasing in the original language or a specified target language, and applying specific writing styles or tones. ```php $result = $deeplClient->rephraseText('The cat sat on the mat.'); echo $result->text; // Returns a rephrased version $results = $deeplClient->rephraseText([ 'The cat sat on the mat.', 'The dog chased the ball.' ]); echo $results[0]->text; // First rephrased text echo $results[1]->text; // Second rephrased text $result = $deeplClient->rephraseText( 'The meeting went well.', 'en-US', ['writing_style' => 'business'] ); $result = $deeplClient->rephraseText( 'We need to discuss this matter.', 'en-US', ['tone' => 'diplomatic'] ); ``` -------------------------------- ### Glossary Management Operations Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Provides functions to retrieve, list, and delete stored glossaries and their dictionaries. It handles operations using glossary IDs or MultilingualGlossaryInfo objects. ```php // Retrieve a stored glossary using the ID $glossaryId = '559192ed-8e23-...'; $myGlossary = $deeplClient->getMultilingualGlossary($glossaryId); $deeplClient->deleteMultilingualGlossaryDictionary($glossaryId, $myGlossary->dictionaries[0]); // Find and delete glossaries named 'Old glossary' $glossaries = $deeplClient->listMultilingualGlossaries(); foreach ($glossaries as $glossary) { if ($glossary->name === 'Old glossary') { $deeplClient->deleteMultilingualGlossary($glossary); } } ``` -------------------------------- ### Replace Multilingual Glossary Dictionary Source: https://github.com/deeplcom/deepl-php/blob/main/upgrading_to_multilingual_glossaries.md Replaces an entire multilingual glossary dictionary with a new set of entries. This operation overwrites existing entries for the specified language pair. ```php $entries = GlossaryEntries::fromEntries(['artist' => 'Maler', 'hello' => 'guten tag']); $myGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $entries); $myGlossary = $deeplClient->createMultilingualGlossary('My glossary', [$myGlossaryDict]); $newEntries = GlossaryEntries::fromEntries(['hello' => 'hallo', 'prize' => 'Gewinn']); $myUpdatedGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $newEntries); $myUpdatedGlossary = $deeplClient->replaceMultilingualGlossaryDictionary( $myGlossary, $myUpdatedGlossaryDict); print_r($myUpdatedGlossary->getEntries()); // Array ( [hello] => hallo, [prize] => Gewinn) ``` -------------------------------- ### Translate Text with Source Language and Multiple Texts Source: https://github.com/deeplcom/deepl-php/blob/main/README.md Shows how to translate a single text with a specified source language (English) and how to translate multiple texts, including auto-detecting the source language for each. ```php // Translate text into a target language, in this case, French: $translationResult = $deeplClient->translateText('Hello, world!', 'en', 'fr'); echo $translationResult->text; // 'Bonjour, le monde !' // Translate multiple texts into British English: $translations = $deeplClient->translateText( ['お元気ですか?', '¿Cómo estás?'], null, 'en-GB', ); echo $translations[0]->text; // 'How are you?' echo $translations[0]->detectedSourceLang; // 'ja' echo $translations[0]->billedCharacters; // 7 - the number of characters in the source text "お元気ですか?" echo $translations[1]->text; // 'How are you?' echo $translations[1]->detectedSourceLang; // 'es' echo $translations[1]->billedCharacters; // 12 - the number of characters in the source text "¿Cómo estás?" ``` -------------------------------- ### Update Multilingual Glossary Dictionary Source: https://github.com/deeplcom/deepl-php/blob/main/upgrading_to_multilingual_glossaries.md Updates an existing multilingual glossary with new entries or a new name. This method allows for incremental updates to glossary dictionaries. ```php $entries = GlossaryEntries::fromEntries(['artist' => 'Maler', 'hello' => 'guten tag']); $myGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $entries); $myGlossary = $deeplClient->createMultilingualGlossary('My glossary', [$myGlossaryDict]); $newEntries = GlossaryEntries::fromEntries(['hello' => 'hallo', 'prize' => 'Gewinn']); $myUpdatedGlossaryDict = new MultilingualGlossaryDictionaryEntries('en', 'de', $newEntries); $myUpdatedGlossary = $deeplClient->updateMultilingualGlossary( $myGlossary, 'My updated glossary', [$myUpdatedGlossaryDict]); print_r($myUpdatedGlossary->dictionaries[0]->getEntries()); // Array ( [artist] => Maler, [hello] => hallo, [prize] => Gewinn) print_r($myUpdatedGlossary->name); // 'My updated glossary' ``` -------------------------------- ### PGP Public Key for Secure Communication Source: https://github.com/deeplcom/deepl-php/blob/main/SECURITY.md This is the PGP public key for the DeepL Security team. It can be used to send encrypted emails to report security concerns or vulnerabilities. ```PGP -----BEGIN PGP PUBLIC KEY BLOCK----- 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 =jVHt -----END PGP PUBLIC KEY BLOCK----- ``` -------------------------------- ### Delete Multilingual Glossary Dictionary Source: https://github.com/deeplcom/deepl-php/blob/main/upgrading_to_multilingual_glossaries.md Deletes a specified glossary dictionary from a given glossary. The dictionary can be identified by its `MultilingualGlossaryDictionaryInfo` object or by providing both source and target languages. ```APIDOC deleteMultilingualGlossaryDictionary($glossary, ?MultilingualGlossaryDictionaryInfo $dictionary, ?string $sourceLang = null, ?string $targetLang = null): void Deletes a specified glossary dictionary from a given glossary. Parameters: $glossary (string|MultilingualGlossaryInfo): Glossary ID or MultilingualGlossaryInfo of the glossary to be deleted. $dictionary (MultilingualGlossaryDictionaryInfo|null): Optional. The dictionary to delete. Either this object or both sourceLang and targetLang must be provided. $sourceLang (string|null): Optional. The source language of the dictionary to delete. $targetLang (string|null): Optional. The target language of the dictionary to delete. Returns: void Migration Note: Ensure that your application logic correctly identifies the dictionary to delete. If using sourceLang and targetLang, both must be provided to specify the dictionary. Example: $entriesEnde = GlossaryEntries::fromEntries(['hello' => 'hallo']); $entriesDeen = GlossaryEntries::fromEntries(['hallo' => 'hello']); $glossaryDictEnde = new MultilingualGlossaryDictionaryEntries('en', 'de', $entriesEnde); $glossaryDictDeen = new MultilingualGlossaryDictionaryEntries('de', 'en', $entriesDeen); $glossaryInfo = $deeplClient->createMultilingualGlossary('My glossary', [$entriesEnde, $entriesDeen]); // Delete via specifying the glossary dictionary $deeplClient->deleteMultilingualGlossaryDictionary($glossaryInfo, $glossaryInfo->dictionaries[0], null, null); // Delete via specifying the language pair $deeplClient->deleteMultilingualGlossaryDictionary($glossaryInfo, null, "de", "en"); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.