GitHub Action
Lokla Action
Since translation app is mostly not compatible with namespaces (i18next), and also pricing is also needs to be considered, We made this app to solve it's problem. With this app, you are able to translate with ease.
These are our key point developing this project
Everyone can contribute to this repository to provide their needs
If you don't want to add additional cost to host the translation, we configure this app so it can be self-hosted with ease. You only need to run it with docker (using docker compose for easier deployment)
We add the github action to the marketplace, so no need to hardly configure your github actions. Only need to call our github actions and fill some parameters, you are ready to go.
To upload the translation to Lokla, Add this to your Github Actions:
- uses: mirfanrafif/lokla-app@0.0.12
with:
project-id: dbk
endpoint: ${{ secrets.lokla_endpoint }}
api-key: ${{ secrets.lokla_api_key }}
main-branch: ${{ github.base_ref }}
directory: src/core/resources/locales
To update your local translation, fetch the translation from API
#!/bin/bash
host=''
project=''
directory=''
apiKey=''
# get all locales
locales=($(ls -d $directory/* | xargs -n 1 basename))
for locale in "${locales[@]}"; do
for file in "${directory}/${locale}"/*; do
namespace=$(basename "${file}" .json)
data=$(curl -s -H "Authorization: Api-Key ${apiKey}" "${host}/api/translations/export?project=${project}&namespace=${namespace}&locale=${locale}")
echo "${data}" >"${file}"
done
done
To deploy the app and API service, we provided docker-compose.yaml
. Don't forget to setup .env
as we provided the .env.example