Sharing interface localization

This commit is contained in:
JannisX11 2021-02-24 09:37:15 +01:00
parent 02ff7e589e
commit af2d349c95
2 changed files with 35 additions and 19 deletions

View File

@ -948,23 +948,23 @@ BARS.defineActions(function() {
new Action('share_model', {
name: 'Share',
icon: 'share',
condition: () => Cube.all.length,
click() {
var dialog = new Dialog({
id: 'share',
title: 'Share Model',
id: 'share_model',
title: 'dialog.share_model.title',
form: {
expire_time: {label: 'Expire Time', type: 'select', default: '2d', options: {
'10m': '10 Minutes',
'1h': '1 Hour',
'1d': '1 Day',
'2d': '2 Days',
'1w': '1 Week',
}}
expire_time: {label: 'dialog.share_model.expire_time', type: 'select', default: '2d', options: {
'10m': tl('dates.minutes', [10]),
'1h': tl('dates.hour', [1]),
'1d': tl('dates.day', [1]),
'2d': tl('dates.days', [2]),
'1w': tl('dates.week', [1]),
}},
info: {type: 'info', text: 'The model will be stored on the Blockbench servers during the duration specified above. [Learn how your data is protected](https://blockbench.net/blockbench-model-sharing-service/)'}
},
buttons: ['Share', 'dialog.cancel'],
buttons: ['generic.share', 'dialog.cancel'],
onConfirm: function(formResult) {
let expire_time = formResult.expire_time;
@ -979,22 +979,19 @@ BARS.defineActions(function() {
type: 'POST',
success: function(response) {
let link = `https://blckbn.ch/${response.id}`
console.log(response, link)
if (isApp) {
clipboard.writeText(link)
Blockbench.showQuickMessage('Link copied to Clipboard')
if (isApp || navigator.clipboard) {
Clipbench.setText(link);
Blockbench.showQuickMessage('dialog.share_model.copied_to_clipboard');
} else {
Blockbench.showMessageBox({
title: 'Model uploaded',
title: 'dialog.share_model.title',
message: `[${link}](${link})`,
})
}
},
error: function(response) {
console.log(response);
Blockbench.showQuickMessage('Error uploading', 1500)
Blockbench.showQuickMessage('dialog.share_model.failed', 1500)
console.error(response);
}
})

View File

@ -33,6 +33,7 @@
"generic.rename": "Rename",
"generic.import": "Import",
"generic.export": "Export",
"generic.share": "Share",
"generic.download": "Download",
"generic.search": "Search",
"generic.help": "Help",
@ -51,6 +52,17 @@
"dates.this_week": "This Week",
"dates.weeks_ago": "%0 weeks ago",
"dates.minute": "%0 Minute",
"dates.minutes": "%0 Minutes",
"dates.hour": "%0 Hour",
"dates.hours": "%0 Hours",
"dates.day": "%0 Day",
"dates.days": "%0 Days",
"dates.week": "%0 Week",
"dates.weeks": "%0 Weeks",
"dates.year": "%0 Year",
"dates.years": "%0 Years",
"mode.start": "Start",
"mode.edit": "Edit",
"mode.paint": "Paint",
@ -367,6 +379,11 @@
"dialog.sketchfab_uploader.private": "Private (Pro)",
"dialog.sketchfab_uploader.password": "Password (Pro)",
"dialog.share_model.title": "Share Model",
"dialog.share_model.expire_time": "Expire Time",
"dialog.share_model.copied_to_clipboard": "Link copied to clipboard",
"dialog.share_model.failed": "Failed to upload model",
"dialog.model_stats.title": "Model Stats",
"dialog.model_stats.cubes": "Cubes",
"dialog.model_stats.locators": "Locators",
@ -715,6 +732,8 @@
"action.export_gltf.desc": "Export model and animations as glTF file to use in other 3D applications",
"action.upload_sketchfab": "Sketchfab Upload",
"action.upload_sketchfab.desc": "Upload your model to Sketchfab",
"action.share_model": "Share...",
"action.share_model.desc": "Generate a short link to share your model",
"action.save_project": "Save Project",
"action.save_project.desc": "Saves the current model as a project file",