Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
546db5d1
Commit
546db5d1
authored
1 month ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Support ctrl/<charset>/text.ini file
For Nelgin's mode7 terminal project
parent
9b53f469
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#8226
passed
1 month ago
Stage: build
Stage: test
Stage: cleanup
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
exec/load/gettext.js
+9
-2
9 additions, 2 deletions
exec/load/gettext.js
src/sbbs3/str.cpp
+8
-1
8 additions, 1 deletion
src/sbbs3/str.cpp
with
17 additions
and
3 deletions
exec/load/gettext.js
+
9
−
2
View file @
546db5d1
// Localized/customized support for JavaScript user-visible text (i.e. strings not contained in text.dat)
// Localized/customized support for JavaScript user-visible text (i.e. strings not contained in text.dat)
// Customized text strings go in the [scriptfilename.js] or [JS] sections of ctrl/text.ini
// Customized text strings go in the [scriptfilename.js] or [JS] sections of ctrl/
[charset/]
text.ini
// Localized (translated to non-default locale) text strings go in the equivalent sections of ctrl/text.<lang>.ini
// Localized (translated to non-default locale) text strings go in the equivalent sections of ctrl/
[charset/]
text.<lang>.ini
// For strings that contain control characters,
// For strings that contain control characters,
// an optional 'key' is typically used/specified to look-up those text strings.
// an optional 'key' is typically used/specified to look-up those text strings.
...
@@ -11,6 +11,9 @@ var gettext_cache = {};
...
@@ -11,6 +11,9 @@ var gettext_cache = {};
function
gettext
(
orig
,
key
)
{
function
gettext
(
orig
,
key
)
{
function
get_text_from_ini
(
ini_fname
,
orig
,
key
){
function
get_text_from_ini
(
ini_fname
,
orig
,
key
){
ini_fname
=
file_getcase
(
ini_fname
);
if
(
!
ini_fname
)
return
undefined
;
var
f
=
new
File
(
ini_fname
);
var
f
=
new
File
(
ini_fname
);
if
(
!
f
.
open
(
"
r
"
))
if
(
!
f
.
open
(
"
r
"
))
return
undefined
;
return
undefined
;
...
@@ -24,6 +27,10 @@ function gettext(orig, key) {
...
@@ -24,6 +27,10 @@ function gettext(orig, key) {
return
gettext_cache
[
key
||
orig
];
return
gettext_cache
[
key
||
orig
];
var
text
;
var
text
;
if
(
user
.
lang
)
if
(
user
.
lang
)
text
=
get_text_from_ini
(
console
.
charset
+
"
/text.
"
+
user
.
lang
+
"
.ini
"
,
orig
,
key
);
if
(
text
===
undefined
)
text
=
get_text_from_ini
(
console
.
charset
+
"
/text.ini
"
,
orig
,
key
);
if
(
text
===
undefined
&&
user
.
lang
)
text
=
get_text_from_ini
(
"
text.
"
+
user
.
lang
+
"
.ini
"
,
orig
,
key
);
text
=
get_text_from_ini
(
"
text.
"
+
user
.
lang
+
"
.ini
"
,
orig
,
key
);
if
(
text
===
undefined
)
if
(
text
===
undefined
)
text
=
get_text_from_ini
(
"
text.ini
"
,
orig
,
key
);
text
=
get_text_from_ini
(
"
text.ini
"
,
orig
,
key
);
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/str.cpp
+
8
−
1
View file @
546db5d1
...
@@ -111,14 +111,21 @@ void sbbs_t::revert_text(void)
...
@@ -111,14 +111,21 @@ void sbbs_t::revert_text(void)
}
}
/****************************************************************************/
/****************************************************************************/
/* Sysops can have custom text based on terminal character set (charset) */
/* Users can have their own language setting, make that current */
/* Users can have their own language setting, make that current */
/****************************************************************************/
/****************************************************************************/
bool
sbbs_t
::
load_user_text
(
void
)
bool
sbbs_t
::
load_user_text
(
void
)
{
{
char
path
[
MAX_PATH
+
1
];
revert_text
();
revert_text
();
safe_snprintf
(
path
,
sizeof
path
,
"%s%s/text.ini"
,
cfg
.
ctrl_dir
,
term_charset
());
if
(
fexistcase
(
path
))
replace_text
(
path
);
if
(
*
useron
.
lang
==
'\0'
)
if
(
*
useron
.
lang
==
'\0'
)
return
true
;
return
true
;
char
path
[
MAX_PATH
+
1
];
safe_snprintf
(
path
,
sizeof
path
,
"%s%s/text.%s.ini"
,
cfg
.
ctrl_dir
,
term_charset
(),
useron
.
lang
);
if
(
fexistcase
(
path
))
replace_text
(
path
);
safe_snprintf
(
path
,
sizeof
path
,
"%stext.%s.ini"
,
cfg
.
ctrl_dir
,
useron
.
lang
);
safe_snprintf
(
path
,
sizeof
path
,
"%stext.%s.ini"
,
cfg
.
ctrl_dir
,
useron
.
lang
);
return
replace_text
(
path
);
return
replace_text
(
path
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment