Skip to content

Commit

Permalink
#762 allow to modify locale from dynawo core
Browse files Browse the repository at this point in the history
closes #762

Signed-off-by: Florentine Rosiere <florentine.rosiere@rte-france.com>
  • Loading branch information
rosiereflo committed Jul 16, 2024
1 parent 1aa6208 commit 61766b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ endfunction()
file(WRITE dictionaries_mapping.dic "")
cat(${DYNAWO_HOME}/share/dictionaries_mapping.dic dictionaries_mapping.dic)
cat_filter(${DYNAWO_ALGORITHMS_HOME}/share/dictionaries_mapping.dic dictionaries_mapping.dic "Algorithms")
file(APPEND dictionaries_mapping.dic "DFLLog = LOG\n")
file(APPEND dictionaries_mapping.dic "DFLError = ERROR\n")
install(FILES dictionaries_mapping.dic DESTINATION ${CMAKE_INSTALL_PREFIX}/share/)

# MPI (required by algorithms)
Expand Down
14 changes: 13 additions & 1 deletion scripts/dynaflow-launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ error_exit() {
exit ${RETURN_CODE}
}

export_var_env() {
local var=$@
local name=${var%%=*}
local value=${var#*=}

if eval "[ \$$name ]"; then
eval "value=\${$name}"
return
fi
export $name="$value"
}

export_preload() {
lib="tcmalloc"
# uncomment to activate tcmalloc in debug when build is in debug
Expand Down Expand Up @@ -34,7 +46,7 @@ export DYNAWO_HOME=$INSTALL
export DYNAWO_ALGORITHMS_HOME=$INSTALL
export LD_LIBRARY_PATH=$INSTALL/lib64:$INSTALL/lib:$LD_LIBRARY_PATH
export IIDM_XML_XSD_PATH=$DYNAWO_HOME/share/iidm/xsd
export DYNAFLOW_LAUNCHER_LOCALE=en_GB
export_var_env DYNAFLOW_LAUNCHER_LOCALE=en_GB
export DYNAFLOW_LAUNCHER_INSTALL=$INSTALL
export DYNAWO_RESOURCES_DIR=$DYNAWO_HOME/share:$DYNAWO_HOME/share/xsd
export DYNAWO_DICTIONARIES=dictionaries_mapping
Expand Down
2 changes: 1 addition & 1 deletion sources/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static inline std::string getMandatoryEnvVar(const std::string &key) {
static void initializeDynawo(const std::string &locale) {
DYN::IoDicos &dicos = DYN::IoDicos::instance();
dicos.addPath(getMandatoryEnvVar("DYNAWO_RESOURCES_DIR"));
dicos.addDicos(getMandatoryEnvVar("DYNAWO_DICTIONARIES"));
dicos.addDicos(getMandatoryEnvVar("DYNAWO_DICTIONARIES"), locale);
dicos.addDico("DFLLOG", "DFLLog", locale);
dicos.addDico("DFLERROR", "DFLError", locale);
}
Expand Down

0 comments on commit 61766b8

Please sign in to comment.