Skip to content

Commit 65f3888

Browse files
authored
Merge pull request #35 from CMU-17313Q/feat/llm-translation
Translation Feature Integration Final. No issues between the microservicebackend and the front end..
2 parents 2af9a30 + f336e09 commit 65f3888

File tree

25 files changed

+102
-217
lines changed

25 files changed

+102
-217
lines changed

build/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

build/export/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

build/export/README

Lines changed: 0 additions & 5 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@adactive/bootstrap-tagsinput": "0.8.2",
40+
"@fontsource-utils/scss": "^0.2.2",
4041
"@fontsource/inter": "5.2.5",
4142
"@fontsource/poppins": "5.2.6",
4243
"@fortawesome/fontawesome-free": "6.7.2",
@@ -105,6 +106,7 @@
105106
"mousetrap": "1.6.5",
106107
"multiparty": "4.2.3",
107108
"nconf": "0.13.0",
109+
"node-fetch": "^3.3.2",
108110
"nodebb-plugin-2factor": "7.5.10",
109111
"nodebb-plugin-anonymous-button": "file:nodebb-plugin-anonymous-button",
110112
"nodebb-plugin-composer-default": "10.2.51",

public/openapi/components/schemas/PostObject.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ PostObject:
1818
For posts received via ActivityPub, it is the url of the original piece of content.
1919
content:
2020
type: string
21+
isEnglish:
22+
type: boolean
23+
translatedContent:
24+
type: string
2125
sourceContent:
2226
type: string
2327
nullable: true
@@ -170,6 +174,10 @@ PostDataObject:
170174
description: A topic identifier
171175
content:
172176
type: string
177+
isEnglish:
178+
type: boolean
179+
translatedContent:
180+
type: string
173181
timestamp:
174182
type: number
175183
votes:

public/openapi/read/categories.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ get:
8282
type: number
8383
content:
8484
type: string
85+
isEnglish:
86+
type: boolean
87+
translatedContent:
88+
type: string
8589
timestampISO:
8690
type: string
8791
description: An ISO 8601 formatted date string (complementing `timestamp`)
@@ -142,6 +146,10 @@ get:
142146
type: number
143147
content:
144148
type: string
149+
isEnglish:
150+
type: boolean
151+
translatedContent:
152+
type: string
145153
sourceContent:
146154
type: string
147155
nullable: true

public/openapi/read/index.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ get:
7777
type: number
7878
content:
7979
type: string
80+
isEnglish:
81+
type: boolean
82+
translatedContent:
83+
type: string
8084
timestampISO:
8185
type: string
8286
description: An ISO 8601 formatted date string (complementing `timestamp`)
@@ -144,6 +148,10 @@ get:
144148
type: number
145149
content:
146150
type: string
151+
isEnglish:
152+
type: boolean
153+
translatedContent:
154+
type: string
147155
sourceContent:
148156
type: string
149157
nullable: true

public/openapi/write/posts/pid.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ get:
3535
description: A topic identifier
3636
content:
3737
type: string
38+
isEnglish:
39+
type: boolean
40+
translatedContent:
41+
type: string
3842
timestamp:
3943
type: number
4044
flagId:

public/scss/admin/fonts.scss

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ $weights: $font-weight-light, $font-weight-normal, $font-weight-semibold, $font-
55
$subsets: (latin, latin-ext);
66

77
@include Inter.faces(
8-
$weights: $weights,
9-
$subsets: $subsets,
10-
$display: fallback,
11-
$directory: "./plugins/core/inter"
8+
$weights: $weights,
9+
$subsets: $subsets,
10+
$display: fallback,
11+
$directory: "./plugins/core/inter"
1212
);
13+
1314
@include Poppins.faces(
14-
$weights: $weights,
15-
$subsets: $subsets,
16-
$display: fallback,
17-
$directory: "./plugins/core/poppins"
15+
$weights: $weights,
16+
$subsets: $subsets,
17+
$display: fallback,
18+
$directory: "./plugins/core/poppins"
1819
);
1920

2021
.ff-base { font-family: $font-family-base !important; }
2122
.ff-sans { font-family: $font-family-sans-serif !important; }
22-
.ff-secondary { font-family: $font-family-secondary; }
23+
.ff-secondary { font-family: $font-family-secondary; }

public/src/client/topic.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,28 @@ define('forum/topic', [
7272

7373
$(window).on('scroll', utils.debounce(updateTopicTitle, 250));
7474

75+
configurePostToggle();
76+
7577
handleTopicSearch();
7678

7779
hooks.fire('action:topic.loaded', ajaxify.data);
7880
};
7981

82+
function configurePostToggle() {
83+
$('.topic').on('click', '.view-translated-btn', function () {
84+
// Toggle the visibility of the next .translated-content div
85+
$(this).closest('.sensitive-content-message').next('.translated-content').toggle();
86+
// Optionally, change the button text based on visibility
87+
var isVisible = $(this).closest('.sensitive-content-message').next('.translated-content').is(':visible');
88+
if (isVisible) {
89+
$(this).text('Hide the translated message.');
90+
} else {
91+
$(this).text('Click here to view the translated message.');
92+
}
93+
});
94+
}
95+
96+
8097
function handleTopicSearch() {
8198
require(['mousetrap'], (mousetrap) => {
8299
if (config.topicSearchEnabled) {

0 commit comments

Comments
 (0)