Skip to content

Commit

Permalink
Added validating JSON translations
Browse files Browse the repository at this point in the history
  • Loading branch information
HadHod committed Nov 12, 2015
1 parent d7d1180 commit 760d9a6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
21 changes: 16 additions & 5 deletions build.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<project name="icplayer" default="dist" basedir=".">
<taskdef name="for" classname="com.icplayer.ac.ForTask" classpath="addons/addon-compiler.jar"/>
<taskdef name="jslint" classname="com.googlecode.jslint4java.ant.JSLintTask" classpath="libs/jslint4java-2.0.5.jar" />

<property file="build.properties" />
<property name="src" location="src/main/java" />
Expand Down Expand Up @@ -217,13 +218,23 @@
<zip destfile="dist/icplayer.zip" basedir="dist/build"/>
</target>

<target name="dist" depends="build" description="Create player package">
<target name="dist" depends="validate-translations-javascript, build" description="Create player package">
<antcall target="copy.dictionary" />
<antcall target="create.package" />
</target>

<target name="dist.full" depends="build.full" description="Create player package after full build">
<antcall target="create.package" />
</target>

<target name="dist.full" depends="build.full" description="Create player package after full build">
<antcall target="create.package" />
</target>

<target name="validate-translations-javascript">
<echo message="Validating JSON in files:" />

<exec executable="python" failonerror="true">
<arg value="validate_translations_javascript.py" />
</exec>

<echo message="All ok" />
</target>

</project>
Binary file added libs/jslint4java-2.0.5.jar
Binary file not shown.
Expand Up @@ -67,7 +67,6 @@ var ice_dictionary = {
"check_title" : "Étiquette 'Vérifier'",
"uncheck_title" : "Étiquette 'Déverrouiller'",
"reset" : "Étiquette 'Réinitialiser'",
"edit_css" : "Editer le CSS",
"preferences" : "Préférences",
"grid_size": "Taille de la grille : ",
"use_grid": "Utiliser la grille: ",
Expand Down Expand Up @@ -207,12 +206,10 @@ var ice_dictionary = {
"right" : "Droite",
"width" : "Largeur",
"height" : "Hauteur",
"name" : "Nom",
"is_reportable" : "Est&nbsp;comptabilisé",
"event_editor" : "Editeur d'événement",
"html_editor" : "Editeur HTML",
"string_list_editor" : "Editeur des Listes de chaînes",
"text_editor" : "Editeur de texte",
"none" : "Aucun",
"change" : "Modifier",
"items_editor" : "Editeurs d'éléments",
Expand All @@ -233,7 +230,6 @@ var ice_dictionary = {
"open_popup_button" : "Ouvrir la pop-up",
"close_popup_button" : "Fermer la pop-up",
"go_to_page_button" : "Aller ŕ la page",
"close_popup_button" : "Fermer la pop-up",
"check_counter_module" : "Compteur de vérifications",
"choice_module" : "Choix",
"is_multi" : "Est&nbsp;multiple",
Expand Down
Expand Up @@ -67,7 +67,6 @@
"check_title" : "Seleccionar el título",
"uncheck_title" : "Deseleccionar el título",
"reset" : "Reiniciar",
"edit_css" : "Editar el CSS",
"preferences" : "Preferencias",
"grid_size": "Tamaño de la cuadrícula: ",
"use_grid": "Uso de la cuadrícula: ",
Expand Down Expand Up @@ -430,16 +429,16 @@
"crossword_property_letter_cells_border_width": "Tipo de letra en el ancho del borde",
"crossword_property_word_numbers": "Número de palabras en el crucigrama",
"crossword_property_marked_column_index": "Indice de la columna marcada",
"crossword_property_marked_row_index": "Indice de la fila marcada",
"crossword_property_marked_row_index": "Indice de la fila marcada",
"Custom_Scoring_info": "Permite a enlazar varios módulos y a crear unas actividades totalmente interactivas con una función de puntuación común.",
"Custom_Scoring_name": "Puntuación personalizada",
"Custom_Scoring_property_script": "Guión",
"Custom_Scoring_property_max_score": "Puntaje máximo",
"Custom_Scoring_property_max_score": "Puntaje máximo",
"Double_State_Button_info": "Permite a los usuarios realizar diferentes acciones en las presentaciones, como cambiar los estados de otros addons cuando se selecciona/deselecciona el botón.",
"Double_State_Button_name": "Botón de doble estado",
"Double_State_Button_property_text": "Texto",
"Double_State_Button_property_image": "Imagen",
"Double_State_Button_property_on_selected": "Sobre la selección",
"Double_State_Button_property_on_selected": "Sobre la selección",
"Double_State_Button_property_text_selected": "Texto seleccionado",
"Double_State_Button_property_image_selected": "Imagen seleccionada",
"Double_State_Button_property_on_deselected": "Deseleccionar",
Expand Down Expand Up @@ -589,7 +588,7 @@
"Lesson_Reset_info": "Permite agregar un botón de click en el que se restablezca la puntuación de la lección",
"Lesson_Reset_property_title" : "Título",
"Lesson_Reset_property_reset_mistakes" : "Reestablecer errores",
"Lesson_Reset_property_reset_checks" : "Reestablecer aciertos",
"Lesson_Reset_property_reset_checks" : "Reestablecer aciertos",
"Logger_info": "Imita la consola de JavaScript en un navegador, que en este caso se puede comparar con un tablón de mensajes.",
"Logger_name": "Logger",
"Magic_Boxes_info": "Permite añadir el juego sopa de letras para la presentación. Para hacer que la actividad funcione, basta con definir todas las letras y posibles respuestas en la sección Propiedades del addon.",
Expand Down Expand Up @@ -997,8 +996,8 @@
"EdgeAnimation_name": "Animación Edge",
"EdgeAnimation_property_animations": "Animaciones",
"EdgeAnimation_property_composition_class": "Tipo de composición",
"EdgeAnimation_property_edge_file": "edge.js",
"EdgeAnimation_property_edge_actions_file": "Acción Edge.js",
"EdgeAnimation_property_edge_file": "edge.js",
"EdgeAnimation_property_edge_actions_file": "Acción Edge.js",
"EdgeAnimation_property_images": "Imagenes",
"EdgeAnimation_property_animation_item": "Número del elemento de animación",
"EdgeAnimation_property_element_id": "Elemento Edge IDs (csv)",
Expand Down
Expand Up @@ -9,7 +9,7 @@
"graduallyToMaxScore" : "Stopniowo do max",
"Group" : "Grupa",
"settings" : "Ustawienia",
"edit_css" : "Edycja CSS",
"edit_css" : "Edytuj CSS",
"edit_css_tip" : "Wskazówka: Ctrl-F: Wyszukaj, Ctrl-G: Wyszukaj następny",
"public_templates" : "Publiczne",
"private_templates" : "Prywatne",
Expand Down Expand Up @@ -67,7 +67,6 @@
"check_title" : "Zaznacz tekst",
"uncheck_title" : "Odznacz tekst",
"reset" : "Usuń dane",
"edit_css" : "Edytuj CSS",
"preferences" : "Preferencje",
"grid_size" : "Rozmiar siatki: ",
"use_grid" : "Użyj siatki: ",
Expand Down
16 changes: 16 additions & 0 deletions validate_translations_javascript.py
@@ -0,0 +1,16 @@
import sys, os
import fnmatch
import json
import re

dictionaries_folder = 'src/main/java/com/lorepo/icplayer/public/libs/dictionaries'

for root, dirnames, filenames in os.walk(dictionaries_folder):
for filename in fnmatch.filter(filenames, '*.js'):
file_src = os.path.join(root, filename)

print '*', file_src

with open(file_src, 'r') as file_source:
data = re.sub('.*{', '{', file_source.read().replace(';', ''))
json.loads(data)

0 comments on commit 760d9a6

Please sign in to comment.