mercredi 9 novembre 2016

Create a dynamic language file in Laravel

I have an API

http://l.ssc.com:8888/api/lang/nl

that return this result

{
"h": "Ajustes avanzados",
"p1": "Administración a través de esta página, tanto el WiFi privada como su wifi de invitados.",
"p2": "O seguir por el uso del WiFi a través de nuestras estadísticas.",
"bar_private": "Ajustes WiFi privadas",
"bar_private_t1": "Personalizar la configuración de WiFi privadas",
"bar_private_t2": "nombre WiFi",
"bar_private_t3": "frase de contraseña",
"bar_private_t4": "Canal",
"bar_private_t5": "Tipo de seguridad",
"bar_private_t6": "Ejemplo",
"bar_guest": "Ajustes de WiFi de los huéspedes",
"bar_guest_t1": "Personalizar la configuración de WiFi de visitantes",
"bar_guest_t2": "nombre WiFi",
"bar_guest_t3": "frase de contraseña",
"bar_guest_t4": "Canal",
"bar_guest_t5": "Tipo de seguridad",
"bar_guest_t6": "Ejemplo",
"bar_login": "Método de inicio de sesión",
"bar_login_t1": "Renuncia",
"bar_login_t2": "Contraseña",
"bar_login_t3": "Facebook check-in",
"bar_network": "Configuración de la red",
"bar_lan": "Configuración de LAN",
"bar_firewall": "Configuración del servidor de seguridad",
"bar_cloud_security": "Configuración de seguridad desde la nube"
}

I want turn my language file to return that.

In my /resources/lang/nl/texts.php , I've tried

<?php

    return shell_exec('curl http://l.ssc.com:8888/api/lang/nl');

But it doesn't seem to work. My view doesn't seem to recognize it, and throw this error

Illegal offset type

I just want to access want to be able to access it in my my view like this

@lang('texts.h')
@lang('texts.p1')
@lang('texts.p2')
....
.... and so on ... 


Question

How do I adjust my /resources/lang/nl/texts.php to use my API ?

How would one go about and implement this ?


I'm opening to any suggestions at this moment.

Any hints / suggestions / helps on this be will be much appreciated !



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire