1
0
forked from me/IronOS

Merge pull request #787 from t-8ch/make-translations

TS100: move translation generation to Makefile & rename translations folder
This commit is contained in:
Ben V. Brown
2021-01-16 22:31:17 +11:00
committed by GitHub
38 changed files with 16 additions and 13 deletions

2
.gitignore vendored
View File

@@ -52,7 +52,6 @@ workspace/TS100A/.metadata/
Translation Editor/.vscode/
Translation Editor/__pycache__/
*.pyc
workspace/TS100/src/Translation.cpp
*.lst
*.mk
*.list
@@ -67,7 +66,6 @@ codeship.aes
.vscode/settings.json
# Auto generated files
workspace/TS100/Core/Src/Translation.cpp
workspace/TS100/Core/Inc/unit.h
# IDE configs
.vs/*

View File

@@ -1,6 +1,6 @@
# Translation
If you would like to contribute a translation, use the [Translation Editor](http://htmlpreview.github.io/?https://github.com/Ralim/ts100/blob/master/Translation%20Editor/TranslationEditor.html).
If you would like to contribute a translation, use the [Translation Editor](http://htmlpreview.github.io/?https://github.com/Ralim/ts100/blob/master/Translations/TranslationEditor.html).
[Open a reference language file and optionally a target language file](https://github.com/Ralim/ts100/tree/master/Translation%20Editor).
[Open a reference language file and optionally a target language file](https://github.com/Ralim/ts100/tree/master/Translations).
You can create a pull request with the new / updated json configuration file, and this will include this language into the new builds for the firmware.

View File

@@ -554,7 +554,7 @@ def read_opts():
if len(sys.argv) > 2:
outFileTranslationCPP = sys.argv[2]
else:
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Src")
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Gen")
outFileTranslationCPP = os.path.join(outDir, TRANSLATION_CPP)
if len(sys.argv) > 3:

1
workspace/TS100/Core/Gen/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*

View File

@@ -98,6 +98,8 @@ INCLUDES = -I$(APP_INC_DIR) \
-I$(INC_PD_DRIVERS_DIR) \
$(DEVICE_INCLUDES)
TRANSLATION_FILES=$(wildcard ../../Translations/translation_*.json)
GENERATED_TRANSLATION_SOURCE=Core/Gen/Translation.cpp
SOURCE := $(shell find $(SOURCE_THREADS_DIR) -type f -name '*.c') \
$(shell find $(SOURCE_CORE_DIR) -type f -name '*.c') \
$(shell find $(SOURCE_DRIVERS_DIR) -type f -name '*.c') \
@@ -107,7 +109,8 @@ SOURCE_CPP := $(shell find $(SOURCE_THREADS_DIR) -type f -name '*.cpp') \
$(shell find $(SOURCE_CORE_DIR) -type f -name '*.cpp') \
$(shell find $(SOURCE_DRIVERS_DIR) -type f -name '*.cpp') \
$(shell find $(DEVICE_BSP_DIR) -type f -name '*.cpp') \
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp') \
$(GENERATED_TRANSLATION_SOURCE)
# output folder
HEXFILE_DIR=Hexfile
@@ -288,12 +291,12 @@ $(OUT_HEXFILE).elf : $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) Makefile $(LDSCRI
@echo Linking $(OUTPUT_EXE).elf
@$(CPP) $(CXXFLAGS) $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) $(LIBS) $(LINKER_FLAGS)
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile $(APP_INC_DIR)/unit.h
@test -d $(@D) || mkdir -p $(@D)
@echo Compiling ${<}
@$(CC) -c $(CFLAGS) $< -o $@
$(OUT_OBJS_CPP): $(OUTPUT_DIR)/%.o : %.cpp Makefile
$(OUT_OBJS_CPP): $(OUTPUT_DIR)/%.o : %.cpp Makefile $(APP_INC_DIR)/unit.h
@test -d $(@D) || mkdir -p $(@D)
@echo Compiling ${<}
@$(CPP) -c $(CXXFLAGS) $< -o $@
@@ -303,8 +306,13 @@ $(OUT_OBJS_S): $(OUTPUT_DIR)/%.o: %.S Makefile
@echo 'Building file: $<'
@$(AS) -c $(AFLAGS) $< -o $@
$(APP_INC_DIR)/unit.h $(GENERATED_TRANSLATION_SOURCE): $(TRANSLATION_FILES) Makefile ../../Translations/make_translation.py
@echo 'Building translations'
@cd ../../Translations && python3 make_translation.py
clean :
rm -f $(GENERATED_TRANSLATION_SOURCE) $(SOURCE_CORE_DIR)/Translation.cpp
rm -Rf $(OUTPUT_DIR_BASE)
rm -Rf $(HEXFILE_DIR)

View File

@@ -1,6 +1,6 @@
#!/bin/bash
TRANSLATION_DIR="../../Translation Editor"
TRANSLATION_DIR="../../Translations"
TRANSLATION_SCRIPT="make_translation.py"
# AVAILABLE_LANGUAGES will be calculating according to json files in $TRANSLATION_DIR
@@ -116,10 +116,6 @@ fi
echo "*********************************************"
if [ ${#BUILD_LANGUAGES[@]} -gt 0 ] && [ ${#BUILD_MODELS[@]} -gt 0 ]; then
echo "Generating Translation.cpp"
python3 "$TRANSLATION_DIR/$TRANSLATION_SCRIPT" "$TRANSLATION_DIR"
checkLastCommand
echo "Cleaning previous builds"
rm -rf Hexfile/ >/dev/null
rm -rf Objects/ >/dev/null