Skip to content

Commit

Permalink
Editor: Fixed non-localized prompt messages (mrdoob#28260)
Browse files Browse the repository at this point in the history
* localize the prompts

* no brackets
  • Loading branch information
ycw authored May 3, 2024
1 parent f2766a0 commit f91fe5f
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 11 deletions.
2 changes: 1 addition & 1 deletion editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@

const file = hash.slice( 6 );

if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {
if ( confirm( editor.strings.getKey( 'prompt/file/open' ) ) ) {

const loader = new THREE.FileLoader();
loader.crossOrigin = '';
Expand Down
6 changes: 3 additions & 3 deletions editor/js/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class History {

if ( this.historyDisabled ) {

alert( 'Undo/Redo disabled while scene is playing.' );
alert( this.editor.strings.getKey( 'prompt/history/forbid' ) );
return;

}
Expand Down Expand Up @@ -123,7 +123,7 @@ class History {

if ( this.historyDisabled ) {

alert( 'Undo/Redo disabled while scene is playing.' );
alert( this.editor.strings.getKey( 'prompt/history/forbid' ) );
return;

}
Expand Down Expand Up @@ -241,7 +241,7 @@ class History {

if ( this.historyDisabled ) {

alert( 'Undo/Redo disabled while scene is playing.' );
alert( this.editor.strings.getKey( 'prompt/history/forbid' ) );
return;

}
Expand Down
2 changes: 1 addition & 1 deletion editor/js/Menubar.Examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function MenubarExamples( editor ) {
option.setTextContent( strings.getKey( item.title ) );
option.onClick( function () {

if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {
if ( confirm( strings.getKey( 'prompt/file/open' ) ) ) {

loader.load( 'examples/' + item.file, function ( text ) {

Expand Down
6 changes: 3 additions & 3 deletions editor/js/Menubar.File.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function MenubarFile( editor ) {
option.setTextContent( strings.getKey( 'menubar/file/new' ) );
option.onClick( function () {

if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {
if ( confirm( strings.getKey( 'prompt/file/open' ) ) ) {

editor.clear();

Expand Down Expand Up @@ -81,7 +81,7 @@ function MenubarFile( editor ) {

if ( object === null || object.isMesh === undefined ) {

alert( 'No mesh selected' );
alert( strings.getKey( 'prompt/file/export/noMeshSelected' ) );
return;

}
Expand Down Expand Up @@ -181,7 +181,7 @@ function MenubarFile( editor ) {

if ( object === null ) {

alert( 'No object selected.' );
alert( strings.getKey( 'prompt/file/export/noObjectSelected' ) );
return;

}
Expand Down
2 changes: 1 addition & 1 deletion editor/js/Sidebar.Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function SidebarScript( editor ) {
remove.setMarginLeft( '4px' );
remove.onClick( function () {

if ( confirm( 'Are you sure?' ) ) {
if ( confirm( strings.getKey( 'prompt/script/remove' ) ) ) {

editor.execute( new RemoveScriptCommand( editor, editor.selected, script ) );

Expand Down
4 changes: 2 additions & 2 deletions editor/js/Sidebar.Settings.History.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function SidebarSettingsHistory( editor ) {

if ( value ) {

alert( 'The history will be preserved across sessions.\nThis can have an impact on performance when working with textures.' );
alert( strings.getKey( 'prompt/history/preserve' ) );

const lastUndoCmd = history.undos[ history.undos.length - 1 ];
const lastUndoId = ( lastUndoCmd !== undefined ) ? lastUndoCmd.id : 0;
Expand Down Expand Up @@ -63,7 +63,7 @@ function SidebarSettingsHistory( editor ) {
const option = new UIButton( strings.getKey( 'sidebar/history/clear' ) );
option.onClick( function () {

if ( confirm( 'The Undo/Redo History will be cleared. Are you sure?' ) ) {
if ( confirm( strings.getKey( 'prompt/history/clear' ) ) ) {

editor.history.clear();

Expand Down
32 changes: 32 additions & 0 deletions editor/js/Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ function Strings( config ) {

en: {

'prompt/file/open': 'Any unsaved data will be lost. Are you sure?',
'prompt/file/export/noMeshSelected': 'No Mesh selected!',
'prompt/file/export/noObjectSelected': 'No Object selected!',
'prompt/script/remove': 'Are you sure?',
'prompt/history/clear': 'The Undo/Redo History will be cleared. Are you sure?',
'prompt/history/preserve': 'The history will be preserved across sessions.\nThis can have an impact on performance when working with textures.',
'prompt/history/forbid': 'Undo/Redo disabled while scene is playing.',

'menubar/file': 'File',
'menubar/file/new': 'New',
'menubar/file/import': 'Import',
Expand Down Expand Up @@ -362,6 +370,14 @@ function Strings( config ) {

fr: {

'prompt/file/open': 'Toutes les données non enregistrées seront perdues Êtes-vous sûr ?',
'prompt/file/export/noMeshSelected': 'Aucun maillage sélectionné !',
'prompt/file/export/noObjectSelected': 'Aucun objet sélectionné !',
'prompt/script/remove': 'Es-tu sûr?',
'prompt/history/clear': 'L\'historique d\'annulation/rétablissement sera effacé Êtes-vous sûr ?',
'prompt/history/preserve': 'L\'histoire sera conservée entre les sessions.\nCela peut avoir un impact sur les performances lors de la manipulation des textures.',
'prompt/history/forbid': 'Les fonctions Annuler/Rétablir sont désactivées pendant la lecture de la scène.',

'menubar/file': 'Fichier',
'menubar/file/new': 'Nouveau',
'menubar/file/import': 'Importer',
Expand Down Expand Up @@ -718,6 +734,14 @@ function Strings( config ) {

zh: {

'prompt/file/open': '您确定吗?未保存的数据将会丢失。',
'prompt/file/export/noMeshSelected': '未选择网格!',
'prompt/file/export/noObjectSelected': '未选择对象!',
'prompt/script/remove': '你确定吗?',
'prompt/history/clear': '撤销/重做历史记录将被清除。您确定吗?',
'prompt/history/preserve': '历史将在会话之间保留。\n这可能会影响在处理纹理时的性能。',
'prompt/history/forbid': '在播放场景时,撤消/重做被禁用。',

'menubar/file': '文件',
'menubar/file/new': '新建',
'menubar/file/import': '导入',
Expand Down Expand Up @@ -1074,6 +1098,14 @@ function Strings( config ) {

ja: {

'prompt/file/open': '保存されていないデータは失われます。 本気ですか?',
'prompt/file/export/noMeshSelected': 'メッシュが選択されていません!',
'prompt/file/export/noObjectSelected': 'オブジェクトが選択されていません!',
'prompt/script/remove': '本気ですか?',
'prompt/history/clear': '元に戻す/やり直しの履歴が消去されます。 本気ですか?',
'prompt/history/preserve': '履歴はセッションをまたいで保存されます。\nこれは、テクスチャを操作する際のパフォーマンスに影響を与える可能性があります。',
'prompt/history/forbid': 'シーンの再生中は元に戻す/やり直しは無効になります。',

'menubar/file': 'ファイル',
'menubar/file/new': '新規',
'menubar/file/import': 'インポート',
Expand Down

0 comments on commit f91fe5f

Please sign in to comment.