Skip to content

Commit

Permalink
Merge pull request #737 from TimRudy/Issue729-4
Browse files Browse the repository at this point in the history
Adjust developer notes and script for translation steps
  • Loading branch information
cavearr authored May 3, 2024
2 parents 627e9a5 + f62bb7c commit 2fcbfce
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 1,590 deletions.
12 changes: 3 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,20 @@
*.code-workspace
*.swp
*~
app/icerok.capture.raw
.tmp
dist
cache
docs/_build
node_modules
bower_components
.vscode
.idea
app/resources/collection
app/resources/locale/**/*.json
ice-build/
# WebStorm IDE project folder
.idea
## Temp file for translation process
# From update_translations.sh
app/resources/locale/statistics.txt
# From table_translations.sh
app/resources/locale/readme_table.txit
# Temp files for translation process
statistics.txt
readme_table.txt
# Other
icerok.raw
icerok.capture.raw

62 changes: 32 additions & 30 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,32 @@
//------------------------------------------------------
//-- HOW to invoke the tasks defined in Grunt:
//--
//-- $ grunt serve --> Start icestudio
//-- $ grunt serve --> Start Icestudio
//-- $ grunt dist --> Create the Icestudio package for all
//-- the architectures
//-- $ grunt jshint --> Validate the Javascript files
//-- $ grunt clean --> Clean all the generated files during
//-- the dist TASK (building packages)
//-- $ grunt clean --> Clean all the generated files from
//-- the dist tasks (building packages)
//-- $ grunt gettext--> Extract all the English strings and
//-- write them in the app/resources/locale/template.pot
//-- for being translated into other languajes later
//-- write them in the app/resources/locale/template.pot
//-- for being translated into other languages later
//--------------------------------------------------------------

//--------------------------------------------------------------------
//-- How the translation process works
//--
//-- * The texts in the .js Javascript files are in English
//-- * The text strings in the .js Javascript files are in English
//-- * When 'grunt gettext' is invoked, the English texts are extracted
//-- to the app/resources/locale/template.pot file
//-- (an additional step 'msgmerge' is provided externally, which is
//-- required to re-baseline all the language .po files to the latest
//-- template.pot structure & contents)
//-- * The human translator imports the template.pot file (in PoEdit) and
//-- write the translation into their language, in the corresponding
//-- writes the translation into their language, in the corresponding
//-- .po file
//-- * When 'grunt serve' is invoked, the .po files are converted into
//-- * When 'grunt compiletext' is invoked, the .po files are converted into
//-- .json
//-- * When icestudio starts, the .json files are read
//-- * When Icestudio starts ('grunt serve'), the .json files are read
//--------------------------------------------------------------------

//--------------------------------------------------------------------
Expand Down Expand Up @@ -98,7 +101,7 @@ module.exports = function (grunt) {
//-- WIP = false --> Stable release
const WIP = true;

//-- ICestudio App dir
//-- Icestudio App dir
const APPDIR = "app";

//-- Icestudio package.json
Expand Down Expand Up @@ -230,13 +233,13 @@ module.exports = function (grunt) {
//-- is created as target, for the DIST TASK
//---------------------------------------------------------------

//-- Read the icestudio json package
//-- Read the Icestudio json package
let pkg = grunt.file.readJSON(APP_PACKAGE_JSON);

//-- Read the timestamp. It is added to the icestudio package version
//-- Read the timestamp. It is added to the Icestudio package version
let timestamp = grunt.template.today("yyyymmddhhmm");

//-- In the Stables Releases there is NO timestamp
//-- In the Stable Releases there is NO timestamp
if (!WIP) {
timestamp = "";
}
Expand All @@ -246,15 +249,15 @@ module.exports = function (grunt) {
//-- WIP: with timestamp
pkg.version = pkg.version.replace(/w/, "w" + timestamp);

//-- Icestudio package name: (with version)
//-- Icestudio package name (with version)
//-- Ex. icestudio-0.9.1w202203161003
const ICESTUDIO_PKG_NAME = `${pkg.name}-${pkg.version}`;

//-------------------------------------------------------------
//-- Constants for the WGET TASK
//-------------------------------------------------------------

//-- Default collection source zip filename (Ej. v0.3.3.zip)
//-- Default collection source .zip filename (Ej. v0.3.3.zip)
const DEFAULT_COLLECTION_ZIP_FILE = `v${pkg.collection}.zip`;

//-- The collection .zip file contains all the files in
Expand All @@ -275,7 +278,7 @@ module.exports = function (grunt) {
//-- EXEC TASK:
//-------------------------------------------------------------------------
//-- Command for making the Windows installer
//-- Execute NSIS, for creating the Icestudio Window installer (.exe)
//-- Execute NSIS, for creating the Icestudio Windows installer (.exe)
//-- The installation script is located in scripts/windows_installer.nsi
const MAKE_INSTALLER = `makensis -DARCH=win64 -DPYTHON=${PYTHON_EXE} \
-DVERSION=${pkg.version} \
Expand All @@ -286,7 +289,7 @@ module.exports = function (grunt) {
//---------------------------------------------------------------

//-- Read the top level package.json
//-- (**not** the icestudio package, but the one in the top level)
//-- (**not** the Icestudio package, but the one in the top level)
let topPkg = grunt.file.readJSON(PACKAGE_JSON);

//-- Get the NW version from the package (the one that is installed)
Expand Down Expand Up @@ -461,7 +464,7 @@ module.exports = function (grunt) {
//-- Create the TIMESTAMP FILE
//----------------------------------------------------------------------
//-- Write the timestamp information in a file
//-- It will be read by icestudio to add the timestamp to the version
//-- It will be read by Icestudio to add the timestamp to the version
grunt.file.write(APP_TIMESTAMP_FILE, JSON.stringify({ ts: timestamp }));

//-----------------------------------------------------------------------
Expand All @@ -485,21 +488,20 @@ module.exports = function (grunt) {
];

//-- Specific tasks to be executed depending on the target architecture
//-- They are exectuted after the COMMON tasks
//-- They are executed after the COMMON tasks
const DIST_PLATFORM_TASKS = {

//-- TARGET_LINUX64
"linux64": [
"compress:linux64", //-- Create the Icestudio zip package
"compress:linux64", //-- Create the Icestudio .zip package
"appimage:linux64", //-- Create the Icestudio appimage package
],

//-- TARGET_WIN64
"win64": [
"shell:winico",
"compress:win64", //-- Create the Icestudio zip package
"compress:win64", //-- Create the Icestudio .zip package
"wget:python64", //-- Download the python package for windows

"exec:nsis64", //-- Build the Windows installer
],

Expand Down Expand Up @@ -679,7 +681,7 @@ module.exports = function (grunt) {
//-- grunt gettext
//-- Extract the English text and write them into the
//-- template file (app/resources/localte/template.pot)
//-- Moreinformation: https://www.npmjs.com/package/grunt-angular-gettext
//-- More information: https://www.npmjs.com/package/grunt-angular-gettext
grunt.registerTask("gettext", [
"nggettext_extract"
]);
Expand All @@ -701,11 +703,11 @@ module.exports = function (grunt) {
]);

//-- grunt server
//-- Start icestudio
//-- Start Icestudio
grunt.registerTask("serve", [
"nggettext_compile", //-- Get the translation in json files
"watch:scripts", //-- Watch the given files. When there is change
//-- icestudio is restarted
//-- Icestudio is restarted
]);

// grunt dist: Create the app package
Expand Down Expand Up @@ -845,8 +847,8 @@ module.exports = function (grunt) {
},

//-- Install the Default collection
//-- The .zip file is unzip in the destination folder
//- https://www.npmjs.com/package/grunt-zip
//-- The .zip file is unzipped in the destination folder
//-- https://www.npmjs.com/package/grunt-zip
unzip: {

'using-router': {
Expand All @@ -861,7 +863,7 @@ module.exports = function (grunt) {
src: CACHE_DEFAULT_COLLECTION_FILE,

//-- Destination folder for its installation
//-- The collection is unzip on the folder APP_RESOURCES/collection
//-- The collection is unzipped in folder APP_RESOURCES/collection
dest: APP_RESOURCES
}
},
Expand Down Expand Up @@ -1015,7 +1017,7 @@ module.exports = function (grunt) {
},

//-- TASK: NWJS
//-- Build the icestudio NWjs app (Executable) for different platforms
//-- Build the Icestudio NWjs app (Executable) for different platforms
//-- It will download the pre-build binaries and create a release folder
//-- The downloaded binaries are stored in the 'icestudio/cache' folder
//-- The release folder is DIST/icestudio/{platform}
Expand Down Expand Up @@ -1275,7 +1277,7 @@ module.exports = function (grunt) {
path: MAC_EXEC_FILE,
},
],
/* -- For code oficial packages of icestudio, for developers maintain commented
/* -- For code oficial packages of Icestudio, for developers maintain commented
"code-sign": {
"signing-identity": "XXXX",
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ Icestudio is a design tool focused on new comers to the FPGA world
Add or update the [app translations](https://github.com/FPGAwars/icestudio/tree/develop/app/resources/locale) using **[Poedit](https://poedit.net/)**.

*Developer note*:
* use `grunt gettext` to extract the labels from the code and update the template file (`template.pot`)
* use `scripts/update_translations.sh` to update current existing `*.po` language files based on the template (before editing them)
* use `grunt compiletext` to regenerate `*.json` language files (these are what the IDE really need) to test them
* use `npm run preptext` before doing translation editing: this extracts the labels from the codebase to update template file `template.pot`; it also runs `scripts/update_translations.sh`, to update the existing `*.po` language files so they are synched to the template
* use `npm run compiletext` to regenerate the `*.json` language files (these are what the IDE really needs) to test them

*Developer note*:
* for Windows, use `npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe"` or equivalent so the postinstall script can run during npm install
* for Windows, use `npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe"` or equivalent so the `postinstall` script can run during npm install
* for Windows, if commands `msgmerge`, `msgfmt` are not found while executing `update_translations.sh`, then they weren't installed with MSYS2/Git Bash; a Windows binary installer for `GNU gettext utils` will take care of this: https://mlocati.github.io/articles/gettext-iconv-windows.html; download the "static" flavor for 64bit Windows; include it in PATH (done in an install step)

## Contributors

Expand Down
6 changes: 3 additions & 3 deletions app/resources/plugins/icerok/js/iceRok.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ this.sigrok = function (cmd) {
switch (cmd.trim()) {

case 'version':
// return "Icestudio sigrok v1.0\n\r";
return "BeagleLogic 1.0\r\n";
// return "Icestudio sigrok v1.0\n";
return "BeagleLogic 1.0\n";
case 'samplerate':
return '12000000';
default:
return "OK\n\r";
return "OK\n";

}
}
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ angular

// Breadcrumbs

$scope.breadcrumbsNavitate = function (selectedItem) {
$scope.breadcrumbsNavigate = function (selectedItem) {
var item;
if (common.isEditingSubmodule) {
alertify.warning(
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ angular
'<a class="action-open-url-external-browser" href="https://twitter.com/JesusArroyo89"><img class="credits-rss-icon" src="resources/images/icon-twitter.svg"></a>',
'who started this project and was the main developer from 2016/Jan/28 to 2019/Oct',
"</p>",
' <p>Thanks to the rest of <a class="action-open-url-external-browser" href="https://github.com/FPGAwars/icestudio#main-page">contributors</a></p>',
' <p>Thanks to the rest of <a class="action-open-url-external-browser" href="https://github.com/FPGAwars/icestudio#user-content-main-page">contributors</a></p>',
' <p><span class="copyleft">&copy;</span> <a class="action-open-url-external-browser" href="https://fpgawars.github.io">FPGAwars</a> 2016-2024</p>',
'<img src="resources/images/fpgawars-logo.png">',
" </div>",
Expand Down
Loading

0 comments on commit 2fcbfce

Please sign in to comment.