diff --git a/ftl/BUILD.bazel b/ftl/BUILD.bazel index e9d227a19..d1448bca0 100644 --- a/ftl/BUILD.bazel +++ b/ftl/BUILD.bazel @@ -27,6 +27,26 @@ py_test( deps = [requirement("fluent-syntax")], ) +py_binary( + name = "sync", + srcs = ["sync.py"], + tags = ["manual"], +) + +py_binary( + name = "extract-strings", + srcs = ["extract-strings.py"], + tags = ["manual"], + deps = [requirement("fluent-syntax")], +) + +py_binary( + name = "transform-string", + srcs = ["transform-string.py"], + tags = ["manual"], + deps = [requirement("fluent-syntax")], +) + # export this file as a way of locating the top level folder in $(location ...) exports_files( ["BUILD.bazel"], diff --git a/ftl/README.md b/ftl/README.md new file mode 100644 index 000000000..589c1de40 --- /dev/null +++ b/ftl/README.md @@ -0,0 +1,3 @@ +Files related to Anki's translations. + +Please see https://translating.ankiweb.net/#/anki/developers diff --git a/scripts/duplicate-string.py b/ftl/duplicate-string.py similarity index 100% rename from scripts/duplicate-string.py rename to ftl/duplicate-string.py diff --git a/scripts/extract-strings.py b/ftl/extract-strings.py similarity index 100% rename from scripts/extract-strings.py rename to ftl/extract-strings.py diff --git a/scripts/synci18n.py b/ftl/sync.py similarity index 91% rename from scripts/synci18n.py rename to ftl/sync.py index b7378d6fb..f929ce935 100644 --- a/scripts/synci18n.py +++ b/ftl/sync.py @@ -10,11 +10,9 @@ import os import sys from typing import Optional, Tuple -repos_bzl = "repos.bzl" -working_folder = "../anki-i18n" - -if not os.path.exists(repos_bzl): - raise Exception("run from workspace root") +root = os.environ["BUILD_WORKSPACE_DIRECTORY"] +repos_bzl = os.path.join(root, "repos.bzl") +working_folder = os.path.join(root, "..", "anki-i18n") if not os.path.exists(working_folder): os.mkdir(working_folder) @@ -35,12 +33,12 @@ modules = [ Module( name="core", repo="git@github.com:ankitects/anki-core-i18n", - ftl=("ftl/core", "core/templates"), + ftl=(os.path.join(root, "ftl", "core"), "core/templates"), ), Module( name="qtftl", repo="git@github.com:ankitects/anki-desktop-ftl", - ftl=("ftl/qt", "desktop/templates"), + ftl=(os.path.join(root, "ftl", "qt"), "desktop/templates"), ), ] @@ -103,7 +101,7 @@ def update_repos_bzl(): out.append(line) open(path, "w").writelines(out) - commit_if_changed(".") + commit_if_changed(root) def commit_if_changed(folder: str): diff --git a/scripts/transform-string.py b/ftl/transform-string.py similarity index 100% rename from scripts/transform-string.py rename to ftl/transform-string.py diff --git a/scripts/BUILD.bazel b/scripts/BUILD.bazel index 67de5adab..bfd938208 100644 --- a/scripts/BUILD.bazel +++ b/scripts/BUILD.bazel @@ -7,15 +7,3 @@ py_binary( stamp = 1, visibility = ["//visibility:public"], ) - -py_binary( - name = "extract-strings", - srcs = ["extract-strings.py"], - deps = [requirement("fluent-syntax")], -) - -py_binary( - name = "transform-string", - srcs = ["transform-string.py"], - deps = [requirement("fluent-syntax")], -)