JavaScript - Traduccion en javascript co php

 
Vista:
sin imagen de perfil
Val: 26
Ha aumentado su posición en 2 puestos en JavaScript (en relación al último mes)
Gráfica de JavaScript

Traduccion en javascript co php

Publicado por luis (15 intervenciones) el 30/04/2018 23:36:32
Hola espero me puedan ayudar:

La cuestión es que tengo que aplicar javascript a php
tengo 3 archivos de js en uno estan las funciones, en otro es donde se cambia el idioma a español e ingles y el tercero donde estan las cadenas de texto que uso.

como puedo hacer para que el javascript pueda reconocer la variable de cambio de idioma del sistema que esta en yii2

1
2
Sideshow.config.language = "en";
Sideshow.init();

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/** 
         La clase principal
         
         class SS 
         
         **/
 
        SS = {
 
        get VERSION() {
          return "0.4.3";
        }
        },
 
 
        controlVariables = [],
        flags = {
        lockMaskUpdate: false,
        changingStep: false,
        skippingStep: false,
        running: false
        },
        wizards = [],
        currentWizard,
 
     AnimationStatus = jazz.Enum("VISIBLE", "FADING_IN", "FADING_OUT", "NOT_DISPLAYED", "NOT_RENDERED", "TRANSPARENT");
 
    function SSException(code, message) {
      this.name = "SSException";
      this.message = "[SIDESHOW_E#" + ("00000000" + code).substr(-8) + "] " + message;
    }
 
    SSException.prototype = new Error();
    SSException.prototype.constructor = SSException;
 
 
    function showWarning(code, message) {
      console.warn("[SIDESHOW_W#" + ("00000000" + code).substr(-8) + "] " + message);
    }
 
    function showDeprecationWarning(message) {
      console.warn("[DEPRECATION_WARNING] " + message);
    }
 
    function parsePxValue(value) {
      if (value.constructor !== String) return value;
      var br = value === "" ? "0" : value;
      return +br.replace("px", "");
    }
 
    function getString(stringKeyValuePair) {
      if (!(SS.config.language in stringKeyValuePair)) {
        showWarning("2001", "String not found for the selected language, getting the first available.");
        return stringKeyValuePair[Object.keys(stringKeyValuePair)[0]];
      }
 
      return stringKeyValuePair[SS.config.language];
    }
 
    function registerInnerHotkeys() {
      $document.keyup(innerHotkeysListener);
    }
 
 
    function unregisterInnerHotkeys() {
      $document.unbind("keyup", innerHotkeysListener);
    }
 
    function innerHotkeysListener(e) {
      //Esc or F1
      if (e.keyCode == 27 || e.keyCode == 112) SS.close();
    }
 
    function registerGlobalHotkeys() {
      $document.keyup(function (e) {
        //F2
        if (e.keyCode == 113) {
          if (e.shiftKey) SS.start({
            listAll: true
          });
          else SS.start();
        }
      });
    }
 
    function removeDOMGarbage() {
      $("[class*=\"sideshow\"]").not(".sideshow-mask-part, .sideshow-mask-corner-part, .sideshow-subject-mask").remove();
    }
 
    var strings = {
      availableWizards: {
        "en": "Available tutorials",
        "es": "Tutoriales Disponibles"
      },
      relatedWizards: {
        "en": "Related Wizards",
        "es": "Tutoriales Relacionados"
      },
      noAvailableWizards: {
        "en": "There's no tutorials available for this page.",
        "es": "No hay tutoriales disponibles para esta página."
      },
      close: {
        "en": "Close",
        "es": "Cerrar"
      },
      estimatedTime: {
        "en": "Estimated Time",
        "es": "Tiempo Estimado"
      },
      next: {
        "en": "Next",
        "es": "Continuar"
      },
      finishWizard: {
        "en": "Finish Wizard",
        "es": "Concluir Tutorial"
      },
 
    };
 
 
    SS.config = {};
 
    SS.config.userPreferencesRoute = null;
 
    SS.config.loggedInUser = null;
 
    SS.config.language = "es";
 
    SS.config.autoSkipIntro = true;
 
    SS.ControlVariables = {};
 
    SS.ControlVariables.set = function (name, value) {
      var variable = {};
      if (this.isDefined(name)) {
        variable = this.getNameValuePair(name);
      } else controlVariables.push(variable);
      variable.name = name;
      variable.value = value;
      return name + "=" + value;
    };
 
    SS.ControlVariables.setIfUndefined = function (name, value) {
      if (!this.isDefined(name)) return this.set(name, value);
    };
 
    SS.ControlVariables.isDefined = function (name) {
      return this.getNameValuePair(name) !== undefined;
    };
 
    SS.ControlVariables.get = function (name) {
      var pair = this.getNameValuePair(name);
      return pair ? pair.value : undefined;
    };
 
    SS.ControlVariables.getNameValuePair = function (name) {
      for (var i = 0; i < controlVariables.length; i++) {
        var variable = controlVariables[i];
        if (variable.name === name) return variable;
      }
    };
 
 
    SS.ControlVariables.remove = function (name) {
      return controlVariables.splice(controlVariables.indexOf(this.getNameValuePair(name)), 1);
    };
 
    SS.ControlVariables.clear = function () {
      controlVariables = [];
    };
 
    var VisualItem = jazz.Class().abstract;
 
    VisualItem.field("$el");
 
    VisualItem.field("status", AnimationStatus.NOT_RENDERED);
 
    VisualItem.method("render", function ($parent) {
      ($parent || $body).append(this.$el);
      this.status = AnimationStatus.NOT_DISPLAYED;
    });
 
    VisualItem.method("destroy", function () {
      this.$el.remove();
    });
 
    var HidableItem = jazz.Class().extending(VisualItem).abstract;
 
    HidableItem.method("show", function (displayButKeepTransparent) {
      if (!this.$el) this.render();
      if (!displayButKeepTransparent) this.$el.removeClass("sideshow-invisible");
      this.$el.removeClass("sideshow-hidden");
      this.status = AnimationStatus.VISIBLE;
    });
 
    HidableItem.method("hide", function (keepHoldingSpace) {
      if (!keepHoldingSpace) this.$el.addClass("sideshow-hidden");
      this.$el.addClass("sideshow-invisible");
      this.status = AnimationStatus.NOT_DISPLAYED;
    });
 
    var FadableItem = jazz.Class().extending(HidableItem).abstract;
 
    FadableItem.method("fadeIn", function (callback, linearTimingFunction) {
      var item = this;
      item.status = AnimationStatus.FADING_IN;
 
      if (!item.$el) this.render();
      if (linearTimingFunction) item.$el.css("animation-timing-function", "linear");
      item.$el.removeClass("sideshow-hidden");
 
      setTimeout(function () {
        item.$el.removeClass("sideshow-invisible");
 
        setTimeout(function () {
          item.status = AnimationStatus.VISIBLE;
          if (linearTimingFunction) item.$el.css("animation-timing-function", "ease");
          if (callback) callback();
        }, longAnimationDuration);
      }, 20); //<-- Yeap, I'm really scheduling a timeout for 20 milliseconds... this is a dirty trick =)
    });
....
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
//bienvenido
Sideshow.registerWizard({
    name: "Welcome",
    title: "Bienvenido",
    description: "Bienvenido a Hotelstock",
    estimatedTime: "1 Minuto",
    		affects: [
 
        function(){
        	return $(".site-index").length>0;
          }
    ]
}).storyLine({
    showStepPosition: true,
    steps: [
 
		{
		    title: "Inicio de sesión",
		    text: "Clic aqui para iniciar tu sesión",
		    subject:"#iniSesion",
		    targets: "#iniSesion",
		    lockSubject: true
		},
    ]
});
 
//Login
Sideshow.registerWizard({
    name: "Login",
    title: "Login",
    description: "Entrar al sistema",
    estimatedTime: "10 Minutos",
    		affects: [
 
        function(){
        		return $(".log").length > 0;
        }
    ]
}).storyLine({
    showStepPosition: true,
    steps: [
    	{
 
		    title: "Login",
		    text: "Para iniciar sesión debe ingresar sus datos.",
		    subject:"#log-form",
		    targets: "#log-form",
		    lockSubject: true,
		},
		{
		    title: "User",
		    text: "Introduzca su nombre de usuario",
		    subject: "#loginform-username",
		    targets: "#loginform-username"
		},
		{
		    title: "Pasword",
		    text: "Debe introducir su contrasena",
		    subject: "#loginform-password",
		    targets: "#loginform-password",
 
		},
		{
		    title: "Lenguaje",
		    text: "Elige tu lenguaje",
		    subject: "#loginform-language",
		    targets: "#loginform-language"
		},
		{
		    title: "Remember Me",
		    text: "Si quieres que tus credenciales sean recordadas, marca la casilla",
		    subject: "#loginform-rememberme",
		    targets:"#loginform-rememberme"
		},
		{
		    title: "Entre en el sistema",
		    text: "Presione el boton para entrar en el sistema",
		    subject: "#botlog",
		    targets: "#botlog",
		    lockSubject: true
		},
    ]
});
//Productos
Sideshow.registerWizard({
    name: "Productos",
    title: "Productos",
    description: "Prodras ver los productos, buscar y añadir nuevos.",
    estimatedTime: "5 Minutos",
    affects: [
 
		  function(){
			return $(".producto-index").length > 0;
		}
    ]
}).storyLine({
    showStepPosition: true,
    steps: [
    	{
		    title: "Productos",
		    text: "Permite al usuario ver la cantidad de producto registrado de la misma manera, estos pueden ser editados, agregados o visualizados"
		},
		{
		    title: "Agregar producto",
		    text: "Al finalizar el tutorial puede dar clic aqui para agregar nuevos productos.",
		    subject: "#btn-newprod",
		    targets: "#btn-newprod",
		    lockSubject:true
		},
		{
		    title: "Filtros",
		    text: function(){/*
Clic aqui para hacer una busqueda más especifica de productos si asi lo requiere.

**En los filtros de esta página encontrará:**

*	Unidad de medida Base: 	*La unidad de medida del producto*

*	Categoria: 	*Categoria a la que pertenece el producto*

*	Codigo de barras del producto: 	*Si tiene disponible el codigo de barras del producto puede buscarlo por el mismo*

*	Producto: 	*nombre del producto que busca*

*	Marca: 	*Marca de el producto*

*	Estado: Si el producto esta actualmente:
1. 	Activo
2. 	Inactivo



`Esta función hace más agiles tus busquedas`


			*/},
			subject: "#Filtros",
			targets: "#Filtros",
			format: "markdown",
			lockSubject: true,
		},
		{
		    title: "Área de productos",
		    text: function(){/*
`En esta área tenemos una vista de productos en general.`

`Al hacer clic en los titulos puedes ordenar alfabeticamente:`

`	Material: Número de identificación del material `

`	Producto: Nombre del producto`

`	Categoria: Categoria a la que pertenece el producto`

`	Unidad de medida base: Unidad de medida base predeterminada para el producto`

`	Código de barras: Código de barras perteneciente al producto `

`	Marca:  Marca registrada para el producto `

`	Estado: Si el producto esta actualmente:
1. 	Activo
2. 	Inactivo`

`	Actualizar o visualizar productos :  Puedes ver el detalle de el produto o actualizar sus opciones predeterminadas `


`Esta función hace más agiles tus busquedas`

			*/},
		    format: "markdown",
		    subject: "#p0",
		    targets: "#p0",
		    lockSubject:true
		},
 
    ]
});



Espero me puedan ayudar con esto ya que nunca he usado php y menos yii2
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder