Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/i18n-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2023 Graz University of Technology.
#
# React-Searchkit is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

name: i18n:pull translations
on: workflow_dispatch # manually trigger

jobs:
i18n-pull:
uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-pull-base.yml@master
secrets: inherit
17 changes: 17 additions & 0 deletions .github/workflows/i18n-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2023 Graz University of Technology.
#
# React-Searchkit is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

name: i18n:push translations
on: workflow_dispatch # manually trigger

jobs:
i18n-extract:
uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-push-base.yml@master
with:
extract-backend: false
frontend-package-path: "./"
secrets: inherit
38 changes: 38 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University.
# Copyright (C) 2023 Graz University of Technology.
#
# React-Searchkit is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

# Translate JavaScript strings
# 1) Install i18n dev dependencies
# npm install
# 2) Add a new language
# npm run init_catalog lang <lang>
# 3) Extract translation keys/values
# $ npm run extract_messages
# 4) Install the transifex-client
# see: https://developers.transifex.com/docs/cli#transifex-client
# 5) Push source (.pot) and translations (.po) to Transifex
# Navigate to the root of the invenio_administration repository
# $ tx push -s -t
# 6) Pull translations for a single language from Transifex
# $ tx pull -l <lang>
# 7) Pull translations for all languages from Transifex
# $ tx pull -a
# 8) Compile .po files for all languages
# $ npm run compile_catalog
# 9) Convert .po file for a single language
# $ npm run compile_catalog lang <lang>

[main]
host = https://app.transifex.com

[o:inveniosoftware:p:invenio:r:react-searchkit-messages-ui]
file_filter = src/lib/translations/messages/<lang>/messages.po
source_file = src/lib/translations/translations.pot
source_lang = en
type = PO
67 changes: 67 additions & 0 deletions i18next-scanner.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// This file is part of React-Searchkit
// Copyright (C) 2021 Graz University of Technology.
//
// React-Searchkit is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.

const { languages } = require("./package").config;

// list of func used to
// mark the strings for translation
const funcList = ["i18next.t"];

// list of extension to look for
const extensions = [".js", ".jsx"];

module.exports = {
options: {
debug: true,
removeUnusedKeys: true,
browserLanguageDetection: true,
func: {
list: funcList,
extensions: extensions,
},
//using Trans component
trans: {
component: "Trans",
extensions: extensions,
fallbackKey: function (ns, value) {
return value;
},
},
lngs: languages,
ns: [
// file name (.json)
"translations",
],
defaultLng: "en",
defaultNs: "translations",
// @param {string} lng The language currently used.
// @param {string} ns The namespace currently used.
// @param {string} key The translation key.
// @return {string} Returns a default value for the translation key.
defaultValue: function (lng, ns, key) {
if (lng === "en") {
// Return key as the default value for English language
return key;
}
return "";
},
resource: {
// The path where resources get loaded from. Relative to current working directory.
loadPath: "src/lib/translations/messages/{{lng}}/{{ns}}.json",

// The path to store resources.
savePath: "src/lib/translations/messages/{{lng}}/{{ns}}.json",

jsonIndent: 2,
lineEnding: "\n",
},
nsSeparator: false, // namespace separator

//Set to false to disable key separator
// if you prefer having keys as the fallback for translation (e.g. gettext).
keySeparator: false,
},
};
Loading
Loading