### Start Phoenix Server Source: https://github.com/mirego/accent/blob/master/README.md Starts the Phoenix web server using the 'phx.server' mix task. This command compiles and runs the application locally for development. ```Elixir mix phx.server ``` -------------------------------- ### Example .env Configuration for Docker Source: https://github.com/mirego/accent/blob/master/README.md Provides an example of the `.env` file required to configure the Accent Docker container, specifying the PostgreSQL database URL and enabling dummy login. ```text DATABASE_URL=postgresql://postgres@docker.for.mac.host.internal/accent_development DUMMY_LOGIN_ENABLED=1 ``` -------------------------------- ### Automating Accent Sync with GitHub Actions (YAML) Source: https://github.com/mirego/accent/blob/master/cli/README.md Provides a GitHub Actions workflow example that automates the `accent sync` process. The workflow runs on a daily schedule, checks out the code, sets up Node.js, installs `accent-cli`, runs the sync command, and creates a pull request with the updated translation files. ```yaml name: Accent on: schedule: - cron: "0 4 * * *" jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 16 - run: npm install -g accent-cli - run: accent sync --add-translations --merge-type=passive --order-by=key - uses: mirego/create-pull-request@v5 with: add-paths: "*.json" commit-message: Update translations committer: github-actions[bot] author: github-actions[bot] branch: accent draft: false delete-branch: true title: New translations are available to merge body: The translation files have been updated, feel free to merge this pull request after review. ``` -------------------------------- ### Setup and Migrate Database Source: https://github.com/mirego/accent/blob/master/README.md Runs the 'ecto.setup' mix task provided by Ecto. This task usually creates the database, runs all pending migrations, and executes seed scripts. ```Elixir mix ecto.setup ``` -------------------------------- ### Installing and Running Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md This snippet demonstrates how to install the Accent CLI globally using npm and shows basic command usage, including checking the version and accessing the help menu. ```sh-session $ npm install -g accent-cli $ accent COMMAND running command... $ accent (-v|--version|version) accent-cli/0.16.2 darwin-arm64 node-v21.6.1 $ accent --help [COMMAND] USAGE $ accent COMMAND ... ``` -------------------------------- ### Install PostgreSQL with Homebrew Source: https://github.com/mirego/accent/blob/master/README.md Installs the PostgreSQL database server using the Homebrew package manager. PostgreSQL is the required database for the Accent application. ```Shell brew install postgres ``` -------------------------------- ### Start Development Application with Docker Source: https://github.com/mirego/accent/blob/master/README.md Executes the 'dev-start-application' target in the Makefile. This command uses Docker Compose to start the application using the previously built Docker image and the Dockerized database. ```Makefile make dev-start-application ``` -------------------------------- ### Example Accent CLI Configuration (JSON) Source: https://github.com/mirego/accent/blob/master/cli/README.md This example shows a complete `accent.json` configuration file structure, including API URL, API key, versioning settings, and file synchronization/export configurations with hooks. ```json { "apiUrl": "http://your.accent.instance", "apiKey": "2nziVSaa8yUJxLkwoZA", "version": { "branchVersionPrefix": "release/" }, "files": [ { "format": "json", "source": "localization/fr/*.json", "target": "localization/%slug%/%document_path%.json", "hooks": { "afterSync": ["touch sync-done.txt", "echo 'Done!'"] } } ] } ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/mirego/accent/blob/master/README.md Executes the 'dependencies' target defined in the project's Makefile. This command typically handles installing both Elixir and Node.js dependencies. ```Makefile make dependencies ``` -------------------------------- ### Start Development PostgreSQL with Docker Source: https://github.com/mirego/accent/blob/master/README.md Executes the 'dev-start-postgresql' target in the Makefile. This command uses Docker Compose to start a local instance of the PostgreSQL database for development purposes. ```Makefile make dev-start-postgresql ``` -------------------------------- ### Install libyaml with Homebrew Source: https://github.com/mirego/accent/blob/master/README.md Installs the libyaml library using the Homebrew package manager. This library is a dependency for certain Elixir libraries used by the project. ```Shell brew install libyaml ``` -------------------------------- ### Run Accent Docker Container Source: https://github.com/mirego/accent/blob/master/README.md Command to run the official Accent Docker image, mapping port 4000 and loading environment variables from a `.env` file to start the webserver and migrate the database. ```shell $ docker run --env-file .env -p 4000:4000 mirego/accent ``` -------------------------------- ### Install Node.js with Homebrew Source: https://github.com/mirego/accent/blob/master/README.md Installs the Node.js runtime using the Homebrew package manager on macOS/Linux. Node.js is typically required for frontend asset compilation and management. ```Shell brew install nodejs ``` -------------------------------- ### Execute Mix Command with nv Source: https://github.com/mirego/accent/blob/master/README.md Example command using the `nv` tool to execute a `mix` command while injecting environment variables from a `.env` file, following the Twelve-Factor App pattern for configuration. ```shell $ nv .env mix ``` -------------------------------- ### Install Elixir with Homebrew Source: https://github.com/mirego/accent/blob/master/README.md Installs the Elixir programming language using the Homebrew package manager. Elixir is the primary language for the Accent backend. ```Shell brew install elixir ``` -------------------------------- ### Deploy Accent on Heroku using CLI (Shell) Source: https://github.com/mirego/accent/blob/master/README.md A step-by-step guide to deploying the Accent application to Heroku using the command-line interface. It covers creating the app, provisioning a PostgreSQL database, setting configuration variables, pushing the Docker image, and releasing the application. ```shell $> heroku create Creating app... done, ⬢ peaceful-badlands-85887 https://peaceful-badlands-85887.herokuapp.com/ | https://git.heroku.com/peaceful-badlands-85887.git $> heroku addons:create heroku-postgresql:hobby-dev --app peaceful-badlands-85887 Creating heroku-postgresql:hobby-dev on ⬢ peaceful-badlands-85887... free Database has been created and is available $> heroku config:set FORCE_SSL=true DATABASE_SSL=true DUMMY_LOGIN_ENABLED=true --app peaceful-badlands-85887 Setting FORCE_SSL, DATABASE_SSL, DUMMY_LOGIN_ENABLED and restarting ⬢ peaceful-badlands-85887... done $> heroku container:push web --app peaceful-badlands-85887 === Building web Your image has been successfully pushed. You can now release it with the 'container:release' command. $> heroku container:release web --app peaceful-badlands-85887 Releasing images web to peaceful-badlands-85887... done ``` -------------------------------- ### Exporting Translations with Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md Provides the usage syntax and examples for the `accent export` command, which fetches translation files from Accent and writes them to the local filesystem. It includes options for specifying the config file, key order, and version. ```shell USAGE $ accent export OPTIONS --config=config [default: accent.json] Path to the config file --order-by=index|key [default: index] Order of the keys --version=version Fetch a specific version EXAMPLES $ accent export $ accent export --order-by=key --version=build.myapp.com:0.12.345 ``` -------------------------------- ### Formatting Local Files with Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md Shows the usage and example for the `accent format` command, used to format local translation files based on server settings. It exits with code 1 if formatting errors are found. Options include specifying the config file and key order. ```shell USAGE $ accent format OPTIONS --config=config [default: accent.json] Path to the config file --order-by=index|key|-index|-key [default: index] Order of the keys EXAMPLE $ accent format ``` -------------------------------- ### Syncing Files with Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md Outlines the usage and examples for the `accent sync` command, which synchronizes local files with Accent and exports updated files. It offers various options for adding translations, dry runs, merge types, order by, sync types, and specifying a version. ```shell USAGE $ accent sync OPTIONS --add-translations Add translations in Accent to help translators if you already have translated strings locally --config=config [default: accent.json] Path to the config file --dry-run Do not write the file from the export _after_ the operation --merge-type=smart|passive|force [default: passive] Algorithm to use on existing strings when adding translation --order-by=index|key [default: index] Will be used in the export call as the order of the keys --sync-type=smart|passive [default: smart] Algorithm to use on existing strings when syncing the main language --version=version Sync a specific version, the tag needs to exists in Accent first EXAMPLES $ accent sync $ accent sync --dry-run --sync-type=force $ accent sync --add-translations --merge-type=smart --order-key=key --version=v0.23 ``` -------------------------------- ### Configuring Ember.js Global Error Handling Source: https://github.com/mirego/accent/blob/master/webapp/MODULE_REPORT.md This snippet shows the start of a method `enableGlobalErrorCatching` within an Ember service, likely related to integrating with a service like Sentry (Raven). It checks if the service is usable and not already initialized, then captures the existing `Ember.onerror` handler before potentially replacing it with a custom one. ```JavaScript enableGlobalErrorCatching() { if (this.isRavenUsable && !this.globalErrorCatchingInitialized) { const _oldOnError = Ember.onerror; Ember.onerror = (error) => { ``` -------------------------------- ### Run Accent API Tests (Shell) Source: https://github.com/mirego/accent/blob/master/README.md Execute the necessary steps to prepare the application and run the API test suite. This involves building the web assets, setting up the database, and running the Elixir tests via Mix. ```shell $ npm --prefix webapp run build $ mix ecto.setup $ mix test ``` -------------------------------- ### Displaying Help with Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md Details the usage of the `accent help` command for displaying help information about Accent CLI or specific commands. It accepts an optional command argument and an option to show all commands. ```shell USAGE $ accent help [COMMAND] ARGUMENTS COMMAND command to show help for OPTIONS --all see all commands in CLI ``` -------------------------------- ### Configuring Version from Git Branch (JSON) Source: https://github.com/mirego/accent/blob/master/cli/README.md This configuration shows how to set up the `version` object to extract version information for CLI commands from the current Git branch name based on a specified prefix. ```json "version": { "branchVersionPrefix": "release/" } ``` -------------------------------- ### Build Docker Release Source: https://github.com/mirego/accent/blob/master/README.md Executes the 'build' target in the Makefile. This command is used to build an OTP release of the application within a Docker container, suitable for production deployment. ```Makefile make build ``` -------------------------------- ### Running CI Check Script - Shell Source: https://github.com/mirego/accent/blob/master/README.md Before submitting a pull request, contributors should execute this script to verify that the continuous integration build will pass, helping to maintain code quality and project stability. ```Shell ./priv/scripts/ci-check.sh ``` -------------------------------- ### Configuring 'file' Name Pattern (JSON) Source: https://github.com/mirego/accent/blob/master/cli/README.md This configuration snippet demonstrates using the default `file` name pattern, where the document name in Accent is derived from the base filename without the extension. ```json { "files": [ { "namePattern": "file", "format": "strings", "source": "Project/Resources/en.lproj/Localizable.strings", "target": "Project/Resources/%slug%.lproj/%document_path%.strings" } ] } ``` -------------------------------- ### Fetching Stats with Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md Provides the usage and options for the `accent stats` command, used to fetch and display translation statistics from the Accent API. Options allow checking for 100% reviewed or translated percentages and viewing stats for a specific version. ```shell USAGE $ accent stats OPTIONS --check-reviewed Exit 1 when reviewed percentage is not 100% --check-translated Exit 1 when translated percentage is not 100% --config=config [default: accent.json] Path to the config file --version=version View stats for a specific version EXAMPLE $ accent stats ``` -------------------------------- ### Configuring 'fileWithSlugSuffix' Name Pattern (JSON) Source: https://github.com/mirego/accent/blob/master/cli/README.md This snippet shows the `fileWithSlugSuffix` pattern configuration, useful when the language slug is part of the filename suffix and should be stripped for the Accent document name. ```json { "files": [ { "namePattern": "fileWithSlugSuffix", "format": "strings", "source": "Project/Resources/Localizable.en.strings", "target": "Project/Resources/%document_path%.%slug%.strings" } ] } ``` -------------------------------- ### Configuring 'fileWithParentDirectory' Name Pattern (JSON) Source: https://github.com/mirego/accent/blob/master/cli/README.md This snippet illustrates the `fileWithParentDirectory` pattern, which uses the file's path relative to the `%slug%` placeholder in the target path to determine the Accent document name. ```json { "files": [ { "namePattern": "fileWithParentDirectory", "source": "translations/en/**/*.json", "target": "translations/%slug%/%document_path%.json" } ] } ``` -------------------------------- ### Basic Robots.txt Allowing All Agents Source: https://github.com/mirego/accent/blob/master/webapp/public/robots.txt This snippet provides a standard robots.txt configuration that permits all web crawlers (indicated by 'User-agent: *') to access all paths on the site (indicated by 'Disallow:'). It includes a comment referencing the robots.txt standard. ```robots.txt # http://www.robotstxt.org User-agent: * Disallow: ``` -------------------------------- ### Configuring 'parentDirectory' Name Pattern (JSON) Source: https://github.com/mirego/accent/blob/master/cli/README.md This configuration uses the `parentDirectory` pattern, which sets the Accent document name to the name of the directory containing the source file, useful for frameworks where files are named only by language. ```json { "files": [ { "namePattern": "parentDirectory", "format": "json", "source": "translations/en.json", "target": "translations/%slug%.json" } ] } ``` -------------------------------- ### Exporting JIPT Files with Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md Explains the `accent jipt` command used to export files for 'Just-In-Place Translation' (JIPT) from Accent. It requires a pseudo language name argument and accepts a config file option. ```shell USAGE $ accent jipt PSEUDOLANGUAGENAME ARGUMENTS PSEUDOLANGUAGENAME The pseudo language for in-place-translation-editing OPTIONS --config=config [default: accent.json] Path to the config file EXAMPLE $ accent jipt ``` -------------------------------- ### Linting Local Files with Accent CLI (Shell) Source: https://github.com/mirego/accent/blob/master/cli/README.md Describes the `accent lint` command, which checks local translation files for errors and displays them. It exits with code 1 if errors are found. It supports specifying a custom config file. ```shell USAGE $ accent lint OPTIONS --config=config [default: accent.json] Path to the config file EXAMPLE $ accent lint ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.