Skip to content

Added i18n support to dbsearch plugin#74

Open
luwei1970 wants to merge 1 commit intobarisusakli:masterfrom
luwei1970:i18n
Open

Added i18n support to dbsearch plugin#74
luwei1970 wants to merge 1 commit intobarisusakli:masterfrom
luwei1970:i18n

Conversation

@luwei1970
Copy link

Modified /lib/dbsearch.js to add internationalization support—including ACP navigation menus and pages; updated the .tpl template file and provided en-GB and zh-CN language files.
修改了/lib/dbsearch.js,添加了国际化支持,包括(ACP导航菜单和页面);修改了 .tpl 模板文件并提供了 en-GB 和 zh-CN 语言文件。

@luwei1970
Copy link
Author

This is an improvement to the dbsearch plugin’s internationalization support—I’m really enjoying your plugin, thanks so much!
Could other contributors please help fill in the remaining language files?
Chinese word segmentation is also an issue; I’ll add a document about that shortly.

@luwei1970
Copy link
Author

@barisusakli I’ve submitted the i18n changes—could you please review them and invite me as a Collaborator? That way I can more easily follow up and merge in the future. Thanks!

results.plugin.progressData = await getProgress();
results.plugin.title = 'DB Search';
res.render('admin/plugins/dbsearch', results.plugin);
translator.translate('[[dbsearch:admin.title]]', function (translated) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't have to manually translate title I think, you can just set results.plugin.title = '[[dbsearch:admin.title]] and it should be translated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

route: '/plugins/dbsearch',
icon: 'fa-search',
name: 'DB Search',
translator.translate('[[dbsearch:admin.menuname]]', function (translated) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for manualy translation just set name to [[dbsearch:admin.menuname]]

const pubsub = require.main.require('./src/pubsub');

let searchLanguage = 'english';
let searchLanguage = 'chinese_zh';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the default as english

"license": "BSD-2-Clause",
"dependencies": {
"lodash": "4.17.21",
"nodebb-plugin-dbsearch": "file:",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this doing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to a local reference because I placed the plugin code in the src/plugins directory of the NodeBB project and bundled it for testing using the file: method. You can easily revert it to the original NPM installation method—just restore the plugin version number in the package.json (or remove this line entirely to return to the default dependency), then reinstall it.

@luwei1970
Copy link
Author

Hi barisusakli,

Thanks for adding me as a participant! I appreciate it and look forward to collaborating on this plugin. Let me know if there’s anything I can help with.

Best,
lw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants