Configuration Location

mojito configuration loaded from the following files in order:

classpath:/application.properties                    # default config
/usr/local/etc/mojito/cli/application.properties     # override config for mojito cli
/usr/local/etc/mojito/webapp/application.properties  # override config for mojito webapp

To override default configurations of mojito, add them in

/usr/local/etc/mojito/cli/application.properties     # for mojito cli
/usr/local/etc/mojito/webapp/application.properties  # for mojito webapp

If you want to use a different path for override configuration, specify the following when you start the server or run the CLI:

-Dspring.config.additional-location=optional:file:/${YOUR_PATH}/application.properties

Using additional-location adds your file to the default configuration. Use optional: so startup succeeds even if the file is missing.

Database Configuration

The default database configuration of mojito is in-memory HSQL database.

flyway.enabled=false
spring.jpa.database=HSQL
spring.jpa.database-platform=org.hibernate.dialect.HSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.datasource.initialize=true
spring.datasource.data=classpath:/db/hsql/data.sql

You can override the database configuration with MySQL.

Install MySQL 8 and then create a database for mojito (with Brew: brew install mysql@8).

Connect to MySQL DB as root user

mysql -u root

Create user ${DB_USERNAME} with ${DB_PASSWORD}

mysql> CREATE USER '${DB_USERNAME}'@'localhost' IDENTIFIED BY '${DB_PASSWORD}';

Create database ${DB_NAME} and give ${DB_USERNAME} full access to the database

mysql> CREATE DATABASE IF NOT EXISTS ${DB_NAME} CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
mysql> GRANT ALL ON ${DB_NAME}.* TO '${DB_USERNAME}'@'localhost' IDENTIFIED BY '${DB_PASSWORD}';
mysql> FLUSH PRIVILEGES;

Configure mojito to use MySQL. When using MySQL, Flyway must be turned on.

flyway.enabled=true
l10n.flyway.clean=false
spring.jpa.database=MYSQL
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=none
spring.datasource.url=jdbc:mysql://localhost:3306/${DB_NAME}?characterEncoding=UTF-8&useUnicode=true&useSSL=false&serverTimezone=UTC
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.testOnBorrow=true
spring.datasource.validationQuery=SELECT 1

l10n.org.quartz.jobStore.useProperties=true
l10n.org.quartz.scheduler.instanceId=AUTO
l10n.org.quartz.jobStore.isClustered=true
l10n.org.quartz.threadPool.threadCount=10
l10n.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
l10n.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
l10n.org.quartz.jobStore.dataSource=myDS
l10n.org.quartz.dataSource.myDS.driver=com.mysql.cj.jdbc.Driver
l10n.org.quartz.dataSource.myDS.URL=jdbc:mysql://localhost:3306/${DB_NAME}?characterEncoding=UTF-8&useUnicode=true&useSSL=false&serverTimezone=UTC
l10n.org.quartz.dataSource.myDS.user=${DB_USERNAME}
l10n.org.quartz.dataSource.myDS.password=${DB_PASSWORD}
l10n.org.quartz.dataSource.myDS.maxConnections=12
l10n.org.quartz.dataSource.myDS.validationQuery=select 1

Note that utf8mb4 setup has been tested on MySQL 5.7. The server will probably needs some configuration too, for example by editing my.cnf (if installed with brew: /usr/local/etc/my.cnf) with something like:

[client]
default-character-set = utf8mb4

[mysqld]
character-set-server = utf8mb4

Depending on the file size that will be processed, it might be required to increase the max allowed package size

[mysqld]
max_allowed_packet = 256M

If using a older version of MySQL, there is a known issue when creating the schema. One workaround is to use utf8 instead utf8mb4 but it has its limitation in term of character support.

Server Configuration

The default server configuration of mojito to run on port 8080.

server.port=8080

Project Request Configuration

The project request configuration is for the offline translation requests. These settings define where mojito stores xliff files.

By default, mojito uses local file system to manage xliff files.

l10n.dropExporter.type=FILE_SYSTEM
l10n.fileSystemDropExporter.basePath=(Java system property for java.io.tmpdir)/fileSystemDropExporter

Let’s say that java.io.tmpdir is /tmp. When you create a new project request for a repository, mojito generates the following directories.

/tmp/fileSystemDropExporter/<repository name>/<project name>
    |-> Imported Files
    |-> Localized Files
    |-> Queries
    |-> Quotes
    |-> Source Files
        |-> fr-FR_mm-dd-yy.xliff
        |-> ja-JP_mm-dd-yy.xliff

mojito exports xliff files in Source Files directory. You should give them to the translators to translate.

When translators are done, translated xliff files should be put in the Localized Files directory. mojito imports xliff files from this directory.

You can override this default configuration and have project requests to be managed on Box instead of local file system. Refer to Integrating with Box.

AI Translation and AI Review (OpenAI)

AI translation and AI review use the OpenAI HTTP API. Configure an API token and, when required by your network, an optional HTTP proxy for outbound requests. Proxy credentials are handled separately from the OpenAI Bearer token.

AI translation

# Required to enable AI translation features
l10n.ai-translate.openai-client-token=${OPENAI_API_KEY}

# Optional. Default: gpt-4o-2024-08-06
l10n.ai-translate.model-name=gpt-4o-2024-08-06

# Optional. HTTP proxy (host and port must both be set)
l10n.ai-translate.proxy-host=proxy.example.com
l10n.ai-translate.proxy-port=3128
l10n.ai-translate.proxy-user=proxy-user
l10n.ai-translate.proxy-password=${PROXY_PASSWORD}

# Optional. Preferred proxy auth schemes (see below)
# l10n.ai-translate.proxy-preferred-auth-schemes=Basic,Digest

# Optional. Use a dedicated Quartz scheduler for AI translation jobs
l10n.ai-translate.scheduler-name=ai-translate

Keep secrets such as the API token and proxy password out of source control.

Proxy preferred auth schemes

When an HTTP proxy challenges with more than one authentication scheme, Apache HttpClient 5 selects a scheme using its built-in preference order. Leave this property unset to keep those defaults, which is the right choice for most deployments.

Set a comma-separated preference list only when the proxy’s advertised order does not work with HttpClient. For example, if a proxy advertises Digest before Basic but only Basic succeeds:

l10n.ai-translate.proxy-preferred-auth-schemes=Basic,Digest

# Same option for AI review
l10n.ai-review.proxy-preferred-auth-schemes=Basic,Digest

Scheme names are HttpClient 5 authentication scheme names, such as Basic and Digest. Whitespace around commas is ignored.

AI review

AI review uses the same OpenAI client and proxy settings under the l10n.ai-review.* prefix:

l10n.ai-review.openai-client-token=${OPENAI_API_KEY}
l10n.ai-review.model-name=gpt-4o-2024-08-06
l10n.ai-review.proxy-host=proxy.example.com
l10n.ai-review.proxy-port=3128
l10n.ai-review.proxy-user=proxy-user
l10n.ai-review.proxy-password=${PROXY_PASSWORD}
# l10n.ai-review.proxy-preferred-auth-schemes=Basic,Digest
l10n.ai-review.scheduler-name=default

See also AI Translate for web and CLI usage.

Database Authentication

The default user authentication setting in mojito is to use database. User information is stored in database. mojito initially is set up with one default user admin/ChangeMe. You can override the default user settings. These values are only respected on initial bootstrapping.

l10n.security.authenticationType=DATABASE
l10n.bootstrap.defaultUser.username=admin
l10n.bootstrap.defaultUser.password=ChangeMe

With database authentication, mojito users can be added, updated (with new password) and deleted using mojito CLI.

# add user - enter password when prompted
mojito user-create  --username ${USERNAME} --password --surname ${SURNAME} --given-name ${GIVEN_NAME} --common-name ${COMMON_NAME}

# update password - enter password when prompted
mojito user-update --username ${USERNAME} --password

# delete user
mojito user-delete --username ${USERNAME}   

LDAP Authentication

You can override the user authentication setting to use LDAP. Here are the settings required to use LDAP.

l10n.security.authenticationType=LDAP
l10n.security.ldap.url=${URL}
l10n.security.ldap.port=${PORT}
l10n.security.ldap.root=${ROOT}
l10n.security.ldap.userSearchBase=${USER_SEARCH_BASE}
l10n.security.ldap.userSearchFilter=${USER_SEARCH_FILTER}
l10n.security.ldap.groupSearchBase=${GROUP_SEARCH_BASE}
l10n.security.ldap.groupSearchFilter=${GROUP_SEARCH_FILTER}
l10n.security.ldap.groupRoleAttribute=${GROUP_ROLE_ATTR}
l10n.security.ldap.managerDn=${MANAGER_DN}
l10n.security.ldap.managerPassword=${MANAGER_PASSWORD}
l10n.security.ldap.ldif=${LDIF_FILE}

CLI Configuration

The default CLI configuration of mojito is to connect to http://localhost:8080 with admin user.

l10n.resttemplate.host=localhost
l10n.resttemplate.port=8080
l10n.resttemplate.scheme=http
l10n.resttemplate.authentication.credentialProvider=CONFIG
l10n.resttemplate.authentication.username=admin
l10n.resttemplate.authentication.password=ChangeMe

If you want to authenticate the user running CLI on command-line, set the following configuration to prompt the user for the password.

l10n.resttemplate.authentication.credentialProvider=CONSOLE

Please note that the the username defaults to the current user (Java system property for user.name) running the CLI instead of admin. Before updating this configuration, it is strongly recommended to add usernames of users that would run the CLI as described in Database Authentication.

You can override Java system property for user.name with -Duser.name=admin. For example, to run mojito CLI as admin user, enter the following:

java -Duser.name=admin -jar mojito-cli-<version>.jar <cli-commands>

CLI Stateless Auth (MSAL)

The CLI can authenticate with Azure AD using MSAL in a stateless mode. Choose one of the providers and set the corresponding properties.

Common flags:

l10n.resttemplate.authentication-mode=STATELESS
# OR legacy: l10n.resttemplate.authentication-mode=STATEFUL

Providers and properties:

  • MSAL_DEVICE_CODE (interactive on the terminal)
    • l10n.resttemplate.stateless.provider=MSAL_DEVICE_CODE
    • l10n.resttemplate.stateless.msal.authority=https://login.microsoftonline.com/<tenant-id>
    • l10n.resttemplate.stateless.msal.client-id=<expose-api-client-id>
    • l10n.resttemplate.stateless.msal.scopes=api://<audience>/<scope>
  • MSAL_BROWSER_CODE (interactive via system browser)
    • l10n.resttemplate.stateless.provider=MSAL_BROWSER_CODE
    • same properties as device code
  • MSAL_CLIENT_CREDENTIALS (non-interactive; application permissions)
    • l10n.resttemplate.stateless.provider=MSAL_CLIENT_CREDENTIALS
    • l10n.resttemplate.stateless.msal.authority=https://login.microsoftonline.com/<tenant-id>
    • l10n.resttemplate.stateless.msal.client-id=<application-client-id>
    • l10n.resttemplate.stateless.msal.client-secret=<client-credential-client-secret-id>
    • l10n.resttemplate.stateless.msal.scopes=<Application ID URI>/.default

CLI Header Auth (e.g., Cloudflare Access)

Configure the CLI to attach static headers (such as Cloudflare Access credentials) to each request instead of performing the legacy form login or MSAL flows.

l10n.resttemplate.authentication-mode=HEADER
l10n.resttemplate.header.headers.CF-Access-Client-Id=<client-id>
l10n.resttemplate.header.headers.CF-Access-Client-Secret=<client-secret>

Add additional headers as needed by appending more headers.<Name>=<value> properties. Values can also be provided through environment variables using Spring Boot’s relaxed binding, for example L10N_RESTTEMPLATE_HEADER_HEADERS_CF-ACCESS-CLIENT-SECRET.

Box Platform Integration

Custom Configurations

All l10n.boxclient.* configurations are required for BoxSDK Tests to run.

l10n.boxclient.clientId={REQUIRED_FOR_TEST}
l10n.boxclient.clientSecret={REQUIRED_FOR_TEST}
l10n.boxclient.publicKeyId={REQUIRED_FOR_TEST}
l10n.boxclient.privateKey={REQUIRED_FOR_TEST}
l10n.boxclient.privateKeyPassword={REQUIRED_FOR_TEST}
l10n.boxclient.enterpriseId={REQUIRED_FOR_TEST}
l10n.boxclient.appUserId={REQUIRED_FOR_TEST}

l10n.boxclient.rootFolderId={REQUIRED_FOR_TEST}
l10n.boxclient.dropsFolderId={REQUIRED_FOR_TEST}
  • l10n.boxclient.rootFolderId corresponds to the mojito folder
  • l10n.boxclient.dropsFolderId corresponds to the Project Requests folder.

You can also optionally use it in production by setting the following configuration:

l10n.boxclient.useConfigsFromProperties=true

Box App User

  1. A default Box App User is created when the Box Client Configurations are set.
  2. mojito will create the following folder structure under the App User’s root folder.

    The ID of the newly created mojito folder will be stored and used as the rootFolderId

     <UserRootFolder>
     |-> mojito
       |-> Project Requests
    

    Most of the time, this folder will be used to exchange files with others. Follow instructions here to share with collaborators.

    Tips: Access the Box Account as the Admin of the enterprise using the credentials for the Box Developer Account you created.