Skip to content

Commit bff637a

Browse files
committed
Update into to check for errors when changing translator files
1 parent 2b5af12 commit bff637a

4 files changed

Lines changed: 23 additions & 11 deletions

File tree

.github/skills/translation/SKILL.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,15 @@ Each mechanism must be maintained independently. A change in the English text of
5555
Run the `doc/translator.py` script from the repository root to get a full report:
5656

5757
```bash
58-
python doc/translator.py
58+
python translator.py --doc .
5959
```
6060

61-
This generates `translator_report.txt` and `language.dox`. The report shows:
61+
This generates `doc/translator_report.txt` and `doc/language.dox`. The report shows:
6262
- Which translators are fully up to date (inherit directly from `Translator`)
6363
- Which translators are outdated (inherit from an adapter class) and which methods they are
6464
missing
6565
- The percentage of implemented methods per language
6666

67-
To check a specific language only (e.g., German):
68-
69-
```bash
70-
python doc/translator.py de
71-
```
72-
7367
### Finding new or changed English strings
7468

7569
When commits touch `src/translator_en.h`:
@@ -95,6 +89,11 @@ When commits touch `src/translator_en.h`:
9589
5. **Update the adapter**: If a new adapter class was added to `translator_adapter.h` for the
9690
current release, it must include the English fallback for each new method.
9791

92+
Run the following script from the root of the repo to check for build errors:
93+
```bash
94+
bash .github/skills/translation/compile_language.sh
95+
```
96+
9897
### Quality guidelines for translator classes
9998

10099
- Use domain-appropriate software-development terminology, not generic dictionary translations.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
mkdir build
3+
cd build
4+
# create configvalues.h
5+
python3 ../src/configgen.py -maph ../src/config.xml > configvalues.h
6+
# create dummy settings.h
7+
echo "#define IS_SUPPORTED(x) 0" > settings.h
8+
# build the language.cpp file standalone
9+
g++ -c -Wall -Werror -std=c++17 -DDISABLE_JAVACC ../src/language.cpp -I../src -I../libversion -I.

src/configgen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ def main():
900900
elif (sys.argv[1] == "-maph"):
901901
print("/* WARNING: This file is generated!")
902902
print(" * Do not edit this file, but edit config.xml instead and run")
903-
print(" * python configgen.py -map config.xml to regenerate this file!")
903+
print(" * python configgen.py -maph config.xml to regenerate this file!")
904904
print(" */")
905905
print("#ifndef CONFIGVALUES_H")
906906
print("#define CONFIGVALUES_H")

src/qcstring.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ inline int qstricmp_sort( const char *str1, const char *str2 )
9292

9393
int qstrnicmp( const char *str1, const char *str2, size_t len );
9494

95+
#ifndef DISABLE_JAVACC
9596
using JavaCCString = std::basic_string<JAVACC_CHAR_TYPE>;
97+
#endif
9698

9799
/** This is an alternative implementation of QCString. It provides basically
98100
* the same functions but uses std::string as the underlying string type
@@ -128,17 +130,19 @@ class QCString
128130
QCString( int ) = delete;
129131

130132
/** For converting a JavaCC string */
133+
#ifndef DISABLE_JAVACC
131134
QCString( const JavaCCString &s)
132135
{
133136
m_rep.resize(s.size());
134-
memcpy(m_rep.data(),s.data(),s.size());
137+
std::memcpy(m_rep.data(),s.data(),s.size());
135138
}
136139
QCString &operator=( const JavaCCString &s)
137140
{
138141
m_rep.resize(s.size());
139-
memcpy(m_rep.data(),s.data(),s.size());
142+
std::memcpy(m_rep.data(),s.data(),s.size());
140143
return *this;
141144
}
145+
#endif
142146

143147
/** creates a string with room for size characters
144148
* @param[in] size the number of character to allocate (also counting the 0-terminator!)

0 commit comments

Comments
 (0)