Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
stats-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
stats-facil
Validations
5dba66bc
Valider
5dba66bc
rédigé
11 years ago
par
sgiehl
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
refs #4086 fixed translationwriter to work with json files
parent
740854c5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
core/TranslationWriter.php
+9
-24
9 ajouts, 24 suppressions
core/TranslationWriter.php
avec
9 ajouts
et
24 suppressions
core/TranslationWriter.php
+
9
−
24
Voir le fichier @
5dba66bc
...
@@ -86,7 +86,7 @@ class TranslationWriter
...
@@ -86,7 +86,7 @@ class TranslationWriter
/**
/**
* Output translations to string
* Output translations to string
*
*
* @param array $translations Array of translations ( key => translated string )
* @param array $translations
multidimensional
Array of translations (
plugin => array (
key => translated string )
)
* @return string
* @return string
*/
*/
static
public
function
outputTranslation
(
$translations
)
static
public
function
outputTranslation
(
$translations
)
...
@@ -96,33 +96,18 @@ class TranslationWriter
...
@@ -96,33 +96,18 @@ class TranslationWriter
}
}
$en
=
self
::
$baseTranslation
;
$en
=
self
::
$baseTranslation
;
$output
=
array
(
'<?php'
,
'$translations = array('
);
$cleanedTranslations
=
array
();
$deferoutput
=
array
();
/* write all the translations that exist in en.php */
foreach
(
$en
as
$key
=>
$en_translation
)
{
if
(
isset
(
$translations
[
$key
])
&&
!
empty
(
$translations
[
$key
]))
{
$tmp
=
self
::
quote
(
$translations
[
$key
]);
$output
[]
=
"
\t
'
$key
' =>
$tmp
,"
;
}
}
/* write the remaining translations (that don't exist in en.php) */
// filter out all translations that don't exist in english translations
foreach
(
$translations
as
$key
=>
$translation
)
{
foreach
(
$en
AS
$plugin
=>
$enTranslations
)
{
if
(
!
isset
(
$en
[
$key
])
&&
!
empty
(
$translation
))
{
foreach
(
$enTranslations
as
$key
=>
$en_translation
)
{
$tmp
=
self
::
quote
(
$translation
);
if
(
isset
(
$translations
[
$plugin
][
$key
])
&&
!
empty
(
$translations
[
$plugin
][
$key
]))
{
$deferoutput
[]
=
"
\t
'
$key
' =>
$tmp
,"
;
$cleanedTranslations
[
$plugin
][
$key
]
=
$translations
[
$plugin
][
$key
];
}
}
}
}
}
if
(
count
(
$deferoutput
)
>
0
)
{
return
json_encode
(
$cleanedTranslations
,
JSON_UNESCAPED_UNICODE
|
JSON_PRETTY_PRINT
);
$output
[]
=
"
\n\t
// FOR REVIEW"
;
$output
=
array_merge
(
$output
,
$deferoutput
);
}
$output
[]
=
');'
;
return
implode
(
$output
,
"
\n
"
)
.
"
\n
"
;
}
}
/**
/**
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter