### Install Transifex CLI Client Source: https://github.com/tatoeba/tatoeba2/wiki/Updating-your-VM-to-the-new-transifex-client Download and install the latest Transifex CLI client for Linux. Ensure you have sudo privileges for installation. ```bash wget https://github.com/transifex/cli/releases/latest/download/tx-linux-amd64.tar.gz sudo tar -xv -C /usr/local/bin/ -f tx-linux-amd64.tar.gz tx rm tx-linux-amd64.tar.gz ``` -------------------------------- ### Start Tatoeba VM with Vagrant Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md Use this command to download and start the Tatoeba virtual machine. It may take a while to complete. ```bash vagrant up ``` -------------------------------- ### Start Tatoeba VM with VirtualBox Provider Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md If you encounter issues with VirtualBox compatibility, explicitly specify the provider when starting the VM. ```bash vagrant up --provider=virtualbox ``` -------------------------------- ### Install Tatoeba with Ansible Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.local.md Execute the Ansible playbook to install all necessary components for Tatoeba on the local machine. ```sh ansible-playbook ./local.yml ``` -------------------------------- ### Clone Tatoeba Repository Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Clone the Tatoeba repository and navigate into its directory to begin setup. ```bash git clone https://github.com/Tatoeba/tatoeba2 cd tatoeba2 ``` -------------------------------- ### Install vagrant-proxyconf Plugin Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.proxy.md Install the vagrant-proxyconf plugin to enable proxy configuration for Vagrant. This plugin must be installed before configuring proxy settings in the Vagrantfile. ```bash vagrant plugin install vagrant-proxyconf ``` -------------------------------- ### Configure Tatoeba Variables Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.local.md Edit the `host_vars/default` file to customize installation variables such as the code directory and Git repository URL. ```yaml code_dir: /home/johndoe/tatoeba/ git_rep: https://github.com/myfork/tatoeba2 ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/tatoeba/tatoeba2/wiki/Deployment Installs or updates project dependencies using Composer, typically run after 'composer.lock' has been modified. ```sh composer install ``` -------------------------------- ### Access SphinxQL Console Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md Run the sphinxql command to enter the interactive prompt for direct querying of the search engine. Example query provided. ```sql sphinxQL> SELECT id FROM eng_main_index WHERE MATCH('hello'); ``` -------------------------------- ### Generate Project Exports Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md Create a symbolic link to the Tatoeba project directory and then run a script to generate export files. This is typically a one-time setup followed by script execution. ```bash # Just run this command once sudo ln -s /home/vagrant/Tatoeba /var/www-prod # This creates the files available on the Downloads page sudo ./docs/cron/runner.sh ./docs/cron/export.sh ``` -------------------------------- ### Configure Hosts File for Subdomains Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md Modify your system's hosts file to map IP addresses to domain names for accessing subdomains like audio, downloads, and wiki. Examples for general access and specific wiki languages are provided. ```text 127.0.0.1 tato.test audio.tato.test downloads.tato.test ``` ```text 127.0.0.1 wiki.tato.test en.wiki.tato.test de.wiki.tato.test eo.wiki.tato.test es.wiki.tato.test ``` -------------------------------- ### Run Queue Worker Source: https://context7.com/tatoeba/tatoeba2/llms.txt Starts the queue worker process to handle background jobs and tasks. ```bash # Run the queue worker (for background jobs) bin/cake queue runworker ``` -------------------------------- ### Get User Profile API Request Source: https://context7.com/tatoeba/tatoeba2/llms.txt Use this cURL command to fetch a user's profile information from the Tatoeba API. ```bash curl "https://api.tatoeba.org/unstable/users/gillux" ``` -------------------------------- ### PHP Controller and Model Naming Conventions Source: https://github.com/tatoeba/tatoeba2/wiki/Code-style Illustrates the use of underscores for controller function names and camelCase for model functions. Private controller functions should start with an underscore. ```php _some_private_controller_function(); } else if ($b) { $value = $this->Model->modelFunctionsAreCamelCase(); } else { $value = __("Doesn't matter.", true); } $this->set('value', $value); } /** * Private functions start with an underscore. * * @return int */ private function _some_private_controller_function() { $array1 = array('a', 'b', 'c'); // If the array is too long, indent it like this. $array2 = array( 'key1' => 'value1' 'key2' => array( 'subkey1' => 'subvalue1', 'subkey2' => 'subvalue2' ) ); switch ($number) { case '1': // some code break; case '2': // some code break; default: // some code break; } while ($number < $otherNumber) { $number++; } for ($i; $i < $number; $i++) { // some code } return 42; } } ?> ``` -------------------------------- ### Get Sentence with Transcriptions and Audio Source: https://context7.com/tatoeba/tatoeba2/llms.txt Retrieve a sentence by ID, including its translations, transcriptions, and audio recordings. Use `showtrans=all` and `include=transcriptions,audios` to fetch all related data. ```bash curl "https://api.tatoeba.org/v1/sentences/12345?showtrans=all&include=transcriptions,audios" ``` -------------------------------- ### Configure Vagrantfile for Proxy Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.proxy.md Add this configuration to your Vagrantfile to set HTTP, HTTPS, and no_proxy settings. Ensure the vagrant-proxyconf plugin is installed for these settings to take effect. ```ruby Vagrant.configure("2") do |config| if Vagrant.has_plugin?("vagrant-proxyconf") config.proxy.http = "http://username:password@proxy_host:proxy_port" config.proxy.https = "http://username:password@proxy_host:proxy_port" config.proxy.no_proxy = "localhost,127.0.0.1,.example.com" end end ``` -------------------------------- ### Allocate More RAM to VM Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md Modify the 'Vagrantfile' to increase the amount of RAM allocated to the virtual machine. The default is 512MB, and an example shows how to set it to 1GB. ```ruby v.memory = 1024 # allocate 1GB of RAM to the VM ``` -------------------------------- ### Get Sentence by ID with Translations Source: https://context7.com/tatoeba/tatoeba2/llms.txt Retrieve a specific sentence by its ID, including all its translations. Use the `showtrans=all` parameter to include all available translations. ```bash curl "https://api.tatoeba.org/v1/sentences/12345?showtrans=all" ``` -------------------------------- ### Prepare Test Environment for New VM Version Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Set up a new directory, clone the Tatoeba repository, and edit the Vagrantfile to specify the new box version for testing. ```bash # Move to a new directory mkdir ../test_tatovm/ cd ../test_tatovm/ # Pull a fresh copy of Tatoeba # Tip: add -b to pull a specific branch git clone --depth 1 https://github.com/Tatoeba/tatoeba2 cd tatoeba2 # Edit ./Vagrantfile to bump config.vm.box_version to 0.2.0 in ./Vagrantfile # You will probably have to empty caches to work around VERR_NO_LOW_MEMORY error echo 3 | sudo tee /proc/sys/vm/drop_caches # Finally start the VM vagrant up ``` -------------------------------- ### Run Post-Provisioning Tasks with Ansible Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Execute specific Ansible tasks on the provisioned VM using tags. Requires the Ansible playbook path and private key. ```bash ansible-playbook -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory --private-key=~/.vagrant.d/insecure_private_key ansible/vagrant.yml --tag ``` -------------------------------- ### Connect to VM Source: https://github.com/tatoeba/tatoeba2/wiki/Updating-your-VM-to-the-new-transifex-client Connect to your virtual machine using SSH. ```bash vagrant ssh ``` -------------------------------- ### Get Random Sentence ID Source: https://context7.com/tatoeba/tatoeba2/llms.txt Fetches a random sentence ID, with an optional parameter to filter by a specific language code. ```php // Get random sentence ID (optionally filtered by language) $randomId = $this->Sentences->getRandomId('jpn'); ``` -------------------------------- ### Tag Autocomplete for Search Source: https://context7.com/tatoeba/tatoeba2/llms.txt Provides tag suggestions for search input via a GET request, returning JSON results. ```php // Tag autocomplete for search // GET /tags/autocomplete/prov (returns JSON) public function autocomplete($search) { $allTags = $this->Tags->Autocomplete($search); } ``` -------------------------------- ### Remove Tag from Sentence Source: https://context7.com/tatoeba/tatoeba2/llms.txt Removes a specific tag from a sentence using GET request. Requires tag ID and sentence ID. ```php // Remove tag from sentence // GET /tags/remove_tag_from_sentence/42/12345 public function remove_tag_from_sentence($tagId, $sentenceId) { $this->Tags->removeTagFromSentence($tagId, $sentenceId); } ``` -------------------------------- ### Build Local VM with Vagrant Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Update Vagrant boxes and provision the VM using Vagrant and Ansible. This process can take a significant amount of time. ```bash BUILD=1 vagrant box update BUILD=1 vagrant up ``` -------------------------------- ### Create New Production Folder Source: https://github.com/tatoeba/tatoeba2/wiki/Deployment Executes a script to create a new production deployment folder on the server. Ensure the script path is correct. ```sh cd /var ./create-new-prod-folder.sh --no-dry-run ``` -------------------------------- ### Get User Information (Unstable) Source: https://context7.com/tatoeba/tatoeba2/llms.txt Retrieves information about a Tatoeba member including their language proficiencies. This endpoint is unstable and may change. ```APIDOC ## GET /unstable/users/{username} ### Description Retrieves information about a Tatoeba member including their language proficiencies. This endpoint is unstable and may change. ### Method GET ### Endpoint `/unstable/users/{username}` ### Parameters #### Path Parameters - **username** (string) - Required - The username of the Tatoeba member. ### Request Example ```bash curl "https://api.tatoeba.org/unstable/users/johndoe" ``` ### Response #### Success Response (200) - **data** (object) - Contains the user's profile information. - **username** (string) - The user's username. - **member_since** (string) - The date the user joined Tatoeba. - **languages** (array) - List of languages the user is proficient in or learning. - **lang** (string) - The language code. - **level** (string) - The user's proficiency level in that language (e.g., 'native', 'fluent', 'learning'). #### Response Example ```json { "data": { "username": "johndoe", "member_since": "2015-08-15T10:30:00+00:00", "languages": [ { "lang": "eng", "level": "native" }, { "lang": "spa", "level": "fluent" } ] } } ``` ``` -------------------------------- ### Pull request description for listed issue Source: https://github.com/tatoeba/tatoeba2/wiki/Guidelines-for-submitting-pull-requests When submitting a pull request for a listed issue, start the description with this line to clearly link it to the issue. ```markdown This pull request addresses issue #{number}. ``` -------------------------------- ### Deploy Production Code Source: https://github.com/tatoeba/tatoeba2/wiki/Deployment Connects to the server, navigates to the code directory, checks out the master branch, and pulls the latest changes for the production environment. ```sh cd /var/code git checkout master git pull ``` -------------------------------- ### Activate New Production Folder Source: https://github.com/tatoeba/tatoeba2/wiki/Deployment Sets the newly created production folder as the active deployment using a provided SHA identifier. ```sh ./set-prod-folder.sh {SHA} ``` -------------------------------- ### Run Database Migrations Source: https://context7.com/tatoeba/tatoeba2/llms.txt Applies all pending database migrations to update the database schema. ```bash # Run database migrations bin/cake migrations migrate ``` -------------------------------- ### Create Box Description JSON Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Generate a JSON file describing a new Vagrant box version, including its URL and version number. ```bash newversion=0.2.0 echo '{"name":"tatoeba/tatovm","versions":[{"providers":[{"name":"virtualbox","description":"","url":"./tatoeba.box"}],"version":"'$newversion'"}]}' > /tmp/box.json ``` -------------------------------- ### Migrate Transifex Configuration Source: https://github.com/tatoeba/tatoeba2/wiki/Updating-your-VM-to-the-new-transifex-client Migrate your existing Transifex configuration file to the new format using the tx migrate command. This command will prompt for your new API token. ```bash cd Tatoeba /usr/local/bin/tx migrate ``` -------------------------------- ### Navigate to Ansible Directory Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.local.md Change the current directory to the Ansible project folder before running commands. ```sh cd ansible ``` -------------------------------- ### Initialize SentencesTable Associations Source: https://context7.com/tatoeba/tatoeba2/llms.txt Defines associations with other tables like Users, Languages, SentencesLists, Tags, Translations, Contributions, Transcriptions, Audios, and SentenceComments. Also adds behaviors for Timestamp, Transcriptable, Sphinx (full-text search), and LimitResults. ```php // Table associations public function initialize(array $config) { $this->belongsTo('Users'); $this->belongsTo('Languages'); $this->belongsToMany('SentencesLists'); $this->belongsToMany('Tags', ['joinTable' => 'tags_sentences']); $this->belongsToMany('Translations', [ 'joinTable' => 'sentences_translations', 'foreignKey' => 'sentence_id', 'targetForeignKey' => 'translation_id', ]); $this->hasMany('Contributions'); $this->hasMany('Transcriptions'); $this->hasMany('Audios'); $this->hasMany('SentenceComments'); // Behaviors $this->addBehavior('Timestamp'); $this->addBehavior('Transcriptable'); // Auto-generate transcriptions $this->addBehavior('Sphinx'); // Full-text search $this->addBehavior('LimitResults'); } ``` -------------------------------- ### Create TatoVM Provisioning Alias Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Create a bash alias for the long Ansible playbook command to simplify running provisioning tasks. Source the bashrc to apply the alias. ```bash echo "alias tatovm-provision='ansible-playbook -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory --private-key=~/.vagrant.d/insecure_private_key ansible/vagrant.yml'" >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Get a Sentence by ID Source: https://context7.com/tatoeba/tatoeba2/llms.txt Retrieves a single sentence with its metadata, translations, transcriptions, and audio recordings. The stable endpoint uses `/v1` prefix, while experimental features use `/unstable`. ```APIDOC ## GET /v1/sentences/{id} ### Description Retrieves a single sentence with its metadata, translations, transcriptions, and audio recordings. ### Method GET ### Endpoint `/v1/sentences/{id}` ### Query Parameters - **showtrans** (string) - Optional - Specifies which translations to show. `all` shows all translations. - **showtrans:lang** (string) - Optional - Filters translations to a specific language code (e.g., `fra`). - **include** (string) - Optional - Comma-separated list of related data to include (e.g., `transcriptions,audios`). ### Request Example ```bash curl "https://api.tatoeba.org/v1/sentences/12345?showtrans=all" curl "https://api.tatoeba.org/v1/sentences/12345?showtrans=all&include=transcriptions,audios" curl "https://api.tatoeba.org/v1/sentences/12345?showtrans=all&showtrans:lang=fra" ``` ### Response #### Success Response (200) - **data** (object) - Contains the sentence details, including translations, transcriptions, and audios. - **id** (integer) - The unique identifier of the sentence. - **text** (string) - The sentence text. - **lang** (string) - The language code of the sentence. - **script** (string) - The script used for the sentence (e.g., 'Latin', 'Cyrillic'). - **license** (string) - The license under which the sentence is shared. - **owner** (string) - The username of the sentence owner. - **is_unapproved** (boolean) - Indicates if the sentence is unapproved. - **transcriptions** (array) - List of transcriptions for the sentence. - **audios** (array) - List of audio recordings for the sentence. - **translations** (array) - List of translations of the sentence. - **id** (integer) - The unique identifier of the translation. - **text** (string) - The translation text. - **lang** (string) - The language code of the translation. - **is_direct** (boolean) - Indicates if the translation is direct. #### Response Example ```json { "data": { "id": 12345, "text": "This is an example sentence.", "lang": "eng", "script": null, "license": "CC BY 2.0 FR", "owner": "username", "is_unapproved": false, "transcriptions": [...], "audios": [...], "translations": [ { "id": 67890, "text": "C'est une phrase d'exemple.", "lang": "fra", "is_direct": true, ... } ] } } ``` ``` -------------------------------- ### Get Sentence with Filtered Translations Source: https://context7.com/tatoeba/tatoeba2/llms.txt Retrieve a sentence by ID and filter its translations to a specific language. Use `showtrans=all` and `showtrans:lang=` to specify the desired translation language. ```bash curl "https://api.tatoeba.org/v1/sentences/12345?showtrans=all&showtrans:lang=fra" ``` -------------------------------- ### Run PHPUnit Tests Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md Execute the entire test suite or a specific test file using PHPUnit. The full suite may take a significant amount of time. ```bash phpunit # runs the whole test suite (takes a while) ``` ```bash phpunit tests/TestCase/Model/Table/SentencesTableTest.php # only a specific file ``` -------------------------------- ### Get Sentence with Translations Source: https://context7.com/tatoeba/tatoeba2/llms.txt Retrieves a sentence along with its translations and details using a custom finder method. Requires the sentence ID and an options array specifying which related data to include. ```php // Get sentence with translations $sentence = $this->Sentences->getSentenceWith($id, [ 'translations' => true, 'sentenceDetails' => true ]); ``` -------------------------------- ### Create a Git commit Source: https://github.com/tatoeba/tatoeba2/wiki/Guidelines-for-submitting-pull-requests Commit your staged changes with a descriptive message. Replace your message with a concise summary of your changes. ```bash git commit -m "your message" ``` -------------------------------- ### Configure SphinxConfShell.php for New Language Script Source: https://github.com/tatoeba/tatoeba2/wiki/Adding-a-new-language Update the SphinxConfShell.php file to include the new language's Unicode block. Add it to `$charsetTable` if words are space-separated, or to `$scriptsWithoutWordBoundaries` if it lacks spaces between words. ```php $charsetTable = [ // ... existing entries 'newlang' => [ 'charset' => 'UTF-8', 'table' => 'utf8mb4', 'index' => 'utf8mb4_general_ci', 'collation' => 'utf8mb4_general_ci', 'unicode_block' => 'newlang_unicode_block_range', ], ]; $scriptsWithoutWordBoundaries = [ // ... existing entries 'newlang', ]; ``` -------------------------------- ### Download Audio File Source: https://context7.com/tatoeba/tatoeba2/llms.txt Downloads audio recordings of sentences. Requires the audio author to allow reuse outside Tatoeba. ```APIDOC ## GET /v1/audios/{audio_id}/file ### Description Downloads audio recordings of sentences. Requires the audio author to allow reuse outside Tatoeba. ### Method GET ### Endpoint `/v1/audios/{audio_id}/file` ### Parameters #### Path Parameters - **audio_id** (integer) - Required - The unique identifier of the audio recording. ### Request Example ```bash curl -O "https://api.tatoeba.org/v1/audios/9876/file" ``` ### Response #### Success Response (200) - The audio file is returned directly. #### Error Response (403) - Returned if the author does not allow external reuse of the audio file. ``` -------------------------------- ### Create New List and Add Sentence Controller (AJAX) Source: https://context7.com/tatoeba/tatoeba2/llms.txt Creates a new sentence list and adds a sentence to it in a single AJAX operation. Uses POST to /sentences_lists/add_sentence_to_new_list with a JSON body containing list name and sentence ID. ```php // Create new list and add sentence in one operation (AJAX, JSON) // POST /sentences_lists/add_sentence_to_new_list // Body: { "name": "My List", "sentenceId": 12345 } public function add_sentence_to_new_list() { $list = $this->SentencesLists->createList($listName, $userId); $this->SentencesLists->addSentenceToList($sentenceId, $list->id, $userId); } ``` -------------------------------- ### Access MySQL Database Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md Connect to the MySQL database using the `mysql` client. Commands are provided for both standard user access and root-privileged operations. ```bash mysql tatoeba ``` ```sql MariaDB [tatoeba]> SELECT * FROM users; ... ``` ```bash sudo mysql tatoeba # for operations requiring root privileges ``` -------------------------------- ### Extract Wiki Languages and Configure Hosts Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.md A shell command to dynamically extract language codes from a configuration file and prepend them to the hosts file entry for wiki subdomains. This ensures all configured languages are accessible. ```bash echo -n "127.0.0.1 wiki.tato.test"; \ sudo sed '1,/"languages"/d;/ \],$/,$d' /srv/wiki.tatoeba.org/www/config.js | cut -d'"' -f2 | \ while read lang; do echo -n " $lang.wiki.tato.test"; done; \ echo ``` -------------------------------- ### Execute Provisioning Task with Alias Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Use the created alias to run a specific Ansible provisioning task, such as 'external_tools'. ```bash tatovm-provision --tag external_tools ``` -------------------------------- ### Package Vagrant VM Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Export the current state of the Vagrant VM into a reusable box file. ```bash vagrant package --output tatoeba.box ``` -------------------------------- ### Prepare Production Release Source: https://github.com/tatoeba/tatoeba2/wiki/Deployment Merges the development branch into master, tags the release with a production timestamp, and pushes the changes and tags to the remote repository. ```sh git checkout master git merge dev git tag prod_{YYYY}-{MM}-{DD} git push git push --tags ``` -------------------------------- ### Paginate Audio Recording Search Results Source: https://context7.com/tatoeba/tatoeba2/llms.txt Paginate through audio recording search results. Use the `after` parameter with the cursor from the previous response and `limit` to control the number of items per page. ```bash curl "https://api.tatoeba.org/unstable/audios?lang=fra&after=1000&limit=100" ``` -------------------------------- ### Search Audio Recordings by Author Source: https://context7.com/tatoeba/tatoeba2/llms.txt List audio recordings filtered by author. This is an unstable endpoint. Use the `author` parameter to specify the author's username and `limit` for the number of results. ```bash curl "https://api.tatoeba.org/unstable/audios?author=kevin&limit=20" ``` -------------------------------- ### Deploy Development Code Source: https://github.com/tatoeba/tatoeba2/wiki/Deployment Connects to the development server, resets the local repository to match the remote 'dev' branch, and pulls the latest code. This is used to avoid conflicts with translation files. ```sh cd /srv/tatoeba.org/www git reset --hard origin/dev && git pull ``` -------------------------------- ### Add New Box Version to Vagrant Source: https://github.com/tatoeba/tatoeba2/blob/dev/README.tatovm.dev.md Register a new Vagrant box version with Vagrant using the created JSON description file. ```bash vagrant box add /tmp/box.json ``` -------------------------------- ### Create a new Git branch Source: https://github.com/tatoeba/tatoeba2/wiki/Guidelines-for-submitting-pull-requests Use this command to create a new branch for your work. Replace `` with a descriptive name for your branch. ```bash git checkout -b ``` -------------------------------- ### Add New Sentence Controller (AJAX) Source: https://context7.com/tatoeba/tatoeba2/llms.txt Handles the addition of a new sentence via an AJAX POST request to /sentences/add_an_other_sentence. Requires selected language, sentence text, and license information. ```php // Add a new sentence (AJAX endpoint) // POST /sentences/add_an_other_sentence // Parameters: selectedLang, value, sentenceLicense public function add_an_other_sentence() { $sentenceLang = $this->request->getData('selectedLang'); $sentenceText = $this->request->getData('value'); $sentenceLicense = $this->request->getData('sentenceLicense'); $savedSentence = $this->CommonSentence->addNewSentence( $sentenceLang, $sentenceText, $userId, $userName, 0, $sentenceLicense ); } ``` -------------------------------- ### Update Translations Source: https://github.com/tatoeba/tatoeba2/wiki/Deployment Fetches the latest translations from Transifex, stages them, and commits them to the repository. Optionally, review UI strings before pushing. ```sh ./tools/update-translations.sh git add src/Locale/ git commit -m "Pull translations from Transifex" git show | grep -E '^(diff|\+msgstr[^ ]* "[^"]")' | less # optionally have a look at the new UI strings git push ``` -------------------------------- ### Search Sentences with Audio by Native Speakers Source: https://context7.com/tatoeba/tatoeba2/llms.txt Find sentences in a specific language that have audio recordings made by native speakers. Use `has_audio=yes` and `is_native=yes` filters. ```bash curl "https://api.tatoeba.org/v1/sentences?lang=jpn&has_audio=yes&is_native=yes&sort=random" ``` -------------------------------- ### View Sentence List Controller Source: https://context7.com/tatoeba/tatoeba2/llms.txt Displays a sentence list along with its associated sentences. Accessible via URLs like /eng/sentences_lists/show/123. ```php // View a list with its sentences // URL: /eng/sentences_lists/show/123 public function show($id = null, $lang = null, $translationsLang = null) { $list = $this->SentencesLists->getListWithPermissions($id, CurrentUser::get('id')); $sentencesInList = $this->paginate($this->SentencesSentencesLists, [ 'finder' => ['latest' => $options] ]); } ``` -------------------------------- ### Push branch to origin Source: https://github.com/tatoeba/tatoeba2/wiki/Guidelines-for-submitting-pull-requests Push your local branch to the remote repository and set the upstream tracking. This prepares your branch for a pull request. ```bash git push --set-upstream origin/ ``` -------------------------------- ### Search Audio Recordings by Language Source: https://context7.com/tatoeba/tatoeba2/llms.txt List audio recordings filtered by language. This is an unstable endpoint and may change. Use `lang` to specify the language and `limit` for the number of results. ```bash curl "https://api.tatoeba.org/unstable/audios?lang=jpn&limit=50" ```