Commit 2dbd1174 authored by Kasper Seweryn's avatar Kasper Seweryn 🥞 Committed by Kasper Seweryn
Browse files

Move locales.ts to locales.json and remove unused i18n script

parent e3b734a8
......@@ -28,7 +28,7 @@ Submitting a new language
1. Pull the latest version of ``develop``
2. Create a new branch, e.g ``git checkout -b translations-new-fr-ca``
3. Add your new language code and name in ``front/src/locales.ts``. Use the native language name, as it is what appears in the UI selector.
3. Add your new language code and name in ``front/src/locales.json``. Use the native language name, as it is what appears in the UI selector.
4. Create the ``po`` file from template:
.. code-block:: shell
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
cd "$(dirname $0)/.." # change into base directory
source scripts/utils.sh
locales=$(tail -n +3 src/locales.ts | sed -E 's/^[^[]+\[] =//' | jq -r '.[].code' | grep -v 'en_US')
locales=$(jq -r '.[].code' src/locales.json | grep -v 'en_US')
mkdir -p src/translations
for locale in $locales; do
......
......@@ -3,7 +3,7 @@
cd "$(dirname $0)/.." # change into base directory
source scripts/utils.sh
locales=$(tail -n +3 src/locales.ts | sed -E 's/^[^[]+\[] =//' | jq -r '.[].code')
locales=$(jq -r '.[].code' src/locales.json)
locales_dir="locales"
sources=$(find src -name '*.vue' -o -name '*.html' 2> /dev/null)
js_sources=$(find src -name '*.vue' -o -name '*.js')
......
#!/usr/bin/env -S bash -eux
# Typical use:
# cp -r locales old_locales
# ./scripts/i18n-extract.sh
# ./scripts/i18n-populate-contextualized-strings.sh old_locales locales
# Then review/commit the changes
cd "$(dirname $0)/.." # change into base directory
old_locales_dir=$1
new_locales_dir=$2
locales=$(tail -n +3 src/locales.ts | sed -E 's/^[^[]+\[] =//' | jq -r '.[].code')
# Generate .po files for each available language.
echo $locales
for lang in $locales; do
echo "Fixing contexts for $lang…"
old_po_file=$old_locales_dir/$lang/LC_MESSAGES/app.po
new_po_file=$new_locales_dir/$lang/LC_MESSAGES/app.po
python3 ./scripts/contextualize.py $old_po_file $new_po_file --no-dry-run
done;
import type { Locale } from '@/types'
/* eslint-disable */
export const locales: Locale[] = [
[
{
"code": "ar",
"label": "العربية"
......
import Vue from 'vue'
import GetText from 'vue-gettext'
import { locales } from '@/locales'
import locales from '@/locales.json'
import { usePreferredLanguages } from '@vueuse/core'
import { watch } from '@vue/composition-api'
import { AppModule } from '@/types'
......
......@@ -27,12 +27,6 @@ export interface ThemeEntry {
key: Theme
}
// Locale stuff
export interface Locale {
label: string
code: string
}
// Track stuff
export interface Artist {
name: string
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment