Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
funkwhale
Commits
2dbd1174
Commit
2dbd1174
authored
Apr 21, 2022
by
Kasper Seweryn
🥞
Committed by
Kasper Seweryn
Jul 03, 2022
Browse files
Move locales.ts to locales.json and remove unused i18n script
parent
e3b734a8
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
TRANSLATORS.rst
View file @
2dbd1174
...
...
@@ -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
...
...
front/locales/app.pot
View file @
2dbd1174
This diff is collapsed.
Click to expand it.
front/scripts/i18n-compile.sh
View file @
2dbd1174
...
...
@@ -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
...
...
front/scripts/i18n-extract.sh
View file @
2dbd1174
...
...
@@ -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'
)
...
...
front/scripts/i18n-populate-contextualized-strings.sh
deleted
100755 → 0
View file @
e3b734a8
#!/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
;
front/src/locales.
ts
→
front/src/locales.
json
View file @
2dbd1174
import
type
{
Locale
}
from
'
@/types
'
/* eslint-disable */
export
const
locales
:
Locale
[]
=
[
[
{
"code"
:
"ar"
,
"label"
:
"العربية"
...
...
front/src/modules/locale.ts
View file @
2dbd1174
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
'
...
...
front/src/types.ts
View file @
2dbd1174
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment