diff --git a/editor/js/Strings.js b/editor/js/Strings.js index eca71d71f20ad8..1c2ed6c7c4e30b 100644 --- a/editor/js/Strings.js +++ b/editor/js/Strings.js @@ -350,6 +350,9 @@ function Strings( config ) { 'viewport/controls/grid': 'Grid', 'viewport/controls/helpers': 'Helpers', + 'viewport/info/oneObject': 'Object', + 'viewport/info/oneVertex': 'Vertex', + 'viewport/info/oneTriangle': 'Triangle', 'viewport/info/objects': 'Objects', 'viewport/info/vertices': 'Vertices', 'viewport/info/triangles': 'Triangles', @@ -703,6 +706,9 @@ function Strings( config ) { 'viewport/controls/grid': 'Grille', 'viewport/controls/helpers': 'Helpers', + 'viewport/info/oneObject': 'Objet', + 'viewport/info/oneVertex': 'Sommet', + 'viewport/info/oneTriangle': 'Triangle', 'viewport/info/objects': 'Objets', 'viewport/info/vertices': 'Sommets', 'viewport/info/triangles': 'Triangles', @@ -1056,6 +1062,9 @@ function Strings( config ) { 'viewport/controls/grid': '网格', 'viewport/controls/helpers': '辅助', + 'viewport/info/oneObject': '物体', + 'viewport/info/oneVertex': '顶点', + 'viewport/info/oneTriangle': '三角形', 'viewport/info/objects': '物体', 'viewport/info/vertices': '顶点', 'viewport/info/triangles': '三角形', @@ -1409,6 +1418,9 @@ function Strings( config ) { 'viewport/controls/grid': 'グリッド', 'viewport/controls/helpers': 'オーバーレイ表示', + 'viewport/info/oneObject': 'オブジェクト', + 'viewport/info/oneVertex': '頂点', + 'viewport/info/oneTriangle': '三角形', 'viewport/info/objects': 'オブジェクト', 'viewport/info/vertices': '頂点', 'viewport/info/triangles': '三角形', diff --git a/editor/js/Viewport.Info.js b/editor/js/Viewport.Info.js index a3cf5183a4231c..94136d7e67ed36 100644 --- a/editor/js/Viewport.Info.js +++ b/editor/js/Viewport.Info.js @@ -14,14 +14,18 @@ function ViewportInfo( editor ) { container.setColor( '#fff' ); container.setTextTransform( 'lowercase' ); - const objectsText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' ); + const objectsText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' ); const verticesText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' ); const trianglesText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' ); const frametimeText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' ); - container.add( objectsText, new UIText( strings.getKey( 'viewport/info/objects' ) ), new UIBreak() ); - container.add( verticesText, new UIText( strings.getKey( 'viewport/info/vertices' ) ), new UIBreak() ); - container.add( trianglesText, new UIText( strings.getKey( 'viewport/info/triangles' ) ), new UIBreak() ); + const objectsUnitText = new UIText( strings.getKey( 'viewport/info/objects' ) ); + const verticesUnitText = new UIText( strings.getKey( 'viewport/info/vertices' ) ); + const trianglesUnitText = new UIText( strings.getKey( 'viewport/info/triangles' ) ); + + container.add( objectsText, objectsUnitText, new UIBreak() ); + container.add( verticesText, verticesUnitText, new UIBreak() ); + container.add( trianglesText, trianglesUnitText, new UIBreak() ); container.add( frametimeText, new UIText( strings.getKey( 'viewport/info/rendertime' ) ), new UIBreak() ); signals.objectAdded.add( update ); @@ -75,6 +79,17 @@ function ViewportInfo( editor ) { verticesText.setValue( vertices.format() ); trianglesText.setValue( triangles.format() ); + const pluralRules = new Intl.PluralRules( editor.config.getKey( 'language' ) ); + + const objectsStringKey = ( pluralRules.select( objects ) === 'one' ) ? 'viewport/info/oneObject' : 'viewport/info/objects'; + objectsUnitText.setValue( strings.getKey( objectsStringKey ) ); + + const verticesStringKey = ( pluralRules.select( vertices ) === 'one' ) ? 'viewport/info/oneVertex' : 'viewport/info/vertices'; + verticesUnitText.setValue( strings.getKey( verticesStringKey ) ); + + const trianglesStringKey = ( pluralRules.select( triangles ) === 'one' ) ? 'viewport/info/oneTriangle' : 'viewport/info/triangles'; + trianglesUnitText.setValue( strings.getKey( trianglesStringKey ) ); + } function updateFrametime( frametime ) {