I think we can do the same we did with jaggery base APIM UI using i18next library. http://i18next.com/
thanks, Chanaka On Fri, Mar 24, 2017 at 3:36 AM, Nuwan Dias <nuw...@wso2.com> wrote: > > > On Fri, Mar 24, 2017 at 2:32 PM, Ruwan Abeykoon <ruw...@wso2.com> wrote: > >> Hi Nuwan, >> In SPA, also I assume we have a limited(and finite) set of localized >> strings. I think no need to pass entire i18n file(which may be huge) to >> client side so that the localization is done at client side. Further one >> can argue that transferring the entire i18n file to the client side possess >> a security risk, by exposing too many information about the server. >> Also having an Ajax call to server side to get the translations done >> kills the performance. >> >> So I think it is better in performance wise to translate all the needed >> i18n strings in the respective HTML DOM on the server side. >> > > Well, doesn't it break the whole concept of SPA? The API Store and > Publisher on API Manager 3.0.0 is built using an SPA architecture. Hasn't > this been done before by anybody, doing i18 stuff on the client side? > >> >> Cheers, >> Ruwan >> >> On Fri, Mar 24, 2017 at 2:10 PM, Nuwandi Wickramasinghe < >> nuwan...@wso2.com> wrote: >> >>> >>> >>> On Fri, Mar 24, 2017 at 1:49 PM, Nuwan Dias <nuw...@wso2.com> wrote: >>> >>>> >>>> >>>> On Fri, Mar 24, 2017 at 1:23 PM, Ruwan Abeykoon <ruw...@wso2.com> >>>> wrote: >>>> >>>>> Hi All, >>>>> What if, >>>>> i18n is handled on the server side only, and encode the relevant >>>>> localized strings into HTML by the server-side (js or hbs). >>>>> Client side libraries only read the string values already in the >>>>> client locale within HTML DOM itself and just render the data. No >>>>> client-side i18n. >>>>> >>>> I have a situation where a part of the DOM is created in client side >>> JS. In that case this wouldn't work. >>> >>>> >>>>> What is would be the limitations? >>>>> >>>> >>>> Limitations would be for SPAs where the rendering is done at the client >>>> side. Which would basically mean that SPAs can't have localization. >>>> >>>>> >>>>> Cheers, >>>>> Ruwan >>>>> >>>>> On Fri, Mar 24, 2017 at 11:54 AM, Nipuna Chandradasa <nipu...@wso2.com >>>>> > wrote: >>>>> >>>>>> API of somekind(Rest or a http service endpoint), That we have to >>>>>> think about, that exposes a functionality to retrieve i18n as a json >>>>>> object to layout level or any other global level of the application. So >>>>>> on >>>>>> client side we can use the i18n language details anywhere. >>>>>> We can get the language data from the browser.. that's how we do it >>>>>> anyway i think. We get the i18n based on the what language browser has >>>>>> configured to use. >>>>>> >>>>>> Thank you, >>>>>> >>>>>> On Fri, Mar 24, 2017 at 10:14 AM, Prasanna Dangalla < >>>>>> prasa...@wso2.com> wrote: >>>>>> >>>>>>> On Fri, Mar 24, 2017 at 12:53 AM, Nipuna Chandradasa < >>>>>>> nipu...@wso2.com> wrote: >>>>>>> >>>>>>>> I don't think there is a feasible solution rather than loading i18n >>>>>>>> config file as a json object to the client side in the beginning of the >>>>>>>> app... i think from uuf side we can provide a api for that... WDYT? >>>>>>>> >>>>>>> API in the sense, what kind of an API ? Does this loads all the data >>>>>>> into front end or are you thinking about a filtering mechanism for the >>>>>>> language data by page before you send them to front end ? >>>>>>> >>>>>>> >>>>>>> On Thu, Mar 23, 2017 at 5:29 PM, SajithAR Ariyarathna < >>>>>>> sajit...@wso2.com> wrote: >>>>>>> >>>>>>>> Currently UUF doesn't support i18n in client-side. >>>>>>>> >>>>>>>> @UUF Team, >>>>>>>> We need to come up with a solution for client-side i18n. Shall we >>>>>>>> start a discussion on this? >>>>>>>> >>>>>>>> Thanks. >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Mar 23, 2017 at 4:36 PM, Prasanna Dangalla < >>>>>>>> prasa...@wso2.com> wrote: >>>>>>>> >>>>>>>>> Hi Sajith, >>>>>>>>> >>>>>>>>> This is for Client-side JS >>>>>>>>> >>>>>>>>> *Prasanna Dangalla* >>>>>>>>> Senior Software Engineer, WSO2, Inc.; http://wso2.com/ >>>>>>>>> lean.enterprise.middleware >>>>>>>>> >>>>>>>>> >>>>>>>>> *cell: +94 718 11 27 51* >>>>>>>>> *twitter: @prasa77* >>>>>>>>> >>>>>>>>> On Thu, Mar 23, 2017 at 2:54 PM, SajithAR Ariyarathna < >>>>>>>>> sajit...@wso2.com> wrote: >>>>>>>>> >>>>>>>>>> Hi Prasanna, >>>>>>>>>> >>>>>>>>>> Is there a mechanism defined to use something like i18n in >>>>>>>>>>> javascript ? >>>>>>>>>> >>>>>>>>>> Server-side JS or Client-side JS? >>>>>>>>>> >>>>>>>>>> On Thu, Mar 23, 2017 at 11:02 AM, Ayesha Dissanayaka < >>>>>>>>>> aye...@wso2.com> wrote: >>>>>>>>>> >>>>>>>>>>> Hi Prasanna, >>>>>>>>>>> >>>>>>>>>>> Similar discussion was started sometime back in [1]. >>>>>>>>>>> Issues in [2], [3] have some suggestions. >>>>>>>>>>> >>>>>>>>>>> [1] [Dev][UUF][IS-6] Enable i18n support in javascript >>>>>>>>>>> [2] https://github.com/wso2/carbon-uuf/issues/160 >>>>>>>>>>> [3] https://github.com/wso2/carbon-uuf/issues/166 >>>>>>>>>>> >>>>>>>>>>> @Ayesha: As I understood all these are done for server side JS, >>>>>>>>> I'm wondering about client side JS. >>>>>>>>> >>>>>>>>> >>>>>>>>>> >>>>>>>>>>> On Thu, Mar 23, 2017 at 10:46 AM, Pubudu Gunatilaka < >>>>>>>>>>> pubu...@wso2.com> wrote: >>>>>>>>>>> >>>>>>>>>>>> Adding Manu and Sajith. >>>>>>>>>>>> >>>>>>>>>>>> On Thu, Mar 23, 2017 at 10:44 AM, Prasanna Dangalla < >>>>>>>>>>>> prasa...@wso2.com> wrote: >>>>>>>>>>>> >>>>>>>>>>>>> Hi Nisala, >>>>>>>>>>>>> >>>>>>>>>>>>> I was wondering how to include this in javascript files, not >>>>>>>>>>>>> in hbs files. Is there a way to include in javascrip fiels ? >>>>>>>>>>>>> >>>>>>>>>>>>> Thanks >>>>>>>>>>>>> >>>>>>>>>>>>> *Prasanna Dangalla* >>>>>>>>>>>>> Senior Software Engineer, WSO2, Inc.; http://wso2.com/ >>>>>>>>>>>>> lean.enterprise.middleware >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> *cell: +94 718 11 27 51* >>>>>>>>>>>>> *twitter: @prasa77* >>>>>>>>>>>>> >>>>>>>>>>>>> On Thu, Mar 23, 2017 at 10:33 AM, Nisala Nanayakkara < >>>>>>>>>>>>> nis...@wso2.com> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>>> Hi Prasanna, >>>>>>>>>>>>>> >>>>>>>>>>>>>> UUF has the capability of facilitating above mentioned >>>>>>>>>>>>>> scenario. You can define your language property file under the >>>>>>>>>>>>>> ‘lang’ >>>>>>>>>>>>>> directory as follows. >>>>>>>>>>>>>> >>>>>>>>>>>>>> |----src >>>>>>>>>>>>>> | |----main >>>>>>>>>>>>>> | |---- pages/ >>>>>>>>>>>>>> | |---- fragments/ >>>>>>>>>>>>>> | |---- layouts/ >>>>>>>>>>>>>> | |---- modules/ >>>>>>>>>>>>>> | |---- lang/ >>>>>>>>>>>>>> |----en_US.properties >>>>>>>>>>>>>> | |---- public/ >>>>>>>>>>>>>> >>>>>>>>>>>>>> After that you can use following code segment to achieve your >>>>>>>>>>>>>> requirement in your hbs file. >>>>>>>>>>>>>> >>>>>>>>>>>>>> {{i18n "my.sample.key"}} >>>>>>>>>>>>>> >>>>>>>>>>>>>> Please go through sample app available here[1] if you need >>>>>>>>>>>>>> more clarification. Moreover you can find actual usage above >>>>>>>>>>>>>> code segment >>>>>>>>>>>>>> here[2] and corresponding language file here[3]. >>>>>>>>>>>>>> >>>>>>>>>>>>>> [1] - https://github.com/wso2/carbon >>>>>>>>>>>>>> -uuf/tree/master/samples/apps/org.wso2.carbon.uuf.sample.pet >>>>>>>>>>>>>> s-store.app >>>>>>>>>>>>>> [2] - https://github.com/wso2/carbon >>>>>>>>>>>>>> -uuf/blob/master/samples/apps/org.wso2.carbon.uuf.sample.pet >>>>>>>>>>>>>> s-store.app/src/main/pages/index.hbs#L16 >>>>>>>>>>>>>> [3] - https://github.com/wso2/carbon >>>>>>>>>>>>>> -uuf/blob/master/samples/apps/org.wso2.carbon.uuf.sample.pet >>>>>>>>>>>>>> s-store.app/src/main/lang/en_US.properties >>>>>>>>>>>>>> >>>>>>>>>>>>>> Thanks, >>>>>>>>>>>>>> Nisala >>>>>>>>>>>>>> >>>>>>>>>>>>>> On Thu, Mar 23, 2017 at 9:01 AM, Prasanna Dangalla < >>>>>>>>>>>>>> prasa...@wso2.com> wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>>> Hi Devs, >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Is there a mechanism defined to use something like i18n in >>>>>>>>>>>>>>> javascript ? Does the UUF has the capability of facilitating >>>>>>>>>>>>>>> this ? You >>>>>>>>>>>>>>> inputs are highly appreciated. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Thanks >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> *Prasanna Dangalla* >>>>>>>>>>>>>>> Senior Software Engineer, WSO2, Inc.; http://wso2.com/ >>>>>>>>>>>>>>> lean.enterprise.middleware >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> *cell: +94 718 11 27 51* >>>>>>>>>>>>>>> *twitter: @prasa77* >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>>>> Dev mailing list >>>>>>>>>>>>>>> Dev@wso2.org >>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> -- >>>>>>>>>>>>>> *Nisala Niroshana Nanayakkara,* >>>>>>>>>>>>>> Software Engineer >>>>>>>>>>>>>> Mobile:(+94)717600022 >>>>>>>>>>>>>> WSO2 Inc., http://wso2.com/ >>>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>>> Dev mailing list >>>>>>>>>>>>> Dev@wso2.org >>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> *Pubudu Gunatilaka* >>>>>>>>>>>> Committer and PMC Member - Apache Stratos >>>>>>>>>>>> Software Engineer >>>>>>>>>>>> WSO2, Inc.: http://wso2.com >>>>>>>>>>>> mobile : +94774078049 <%2B94772207163> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> _______________________________________________ >>>>>>>>>>>> Dev mailing list >>>>>>>>>>>> Dev@wso2.org >>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> *Ayesha Dissanayaka* >>>>>>>>>>> Senior Software Engineer, >>>>>>>>>>> WSO2, Inc : http://wso2.com >>>>>>>>>>> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg> >>>>>>>>>>> 20, Palm grove Avenue, Colombo 3 >>>>>>>>>>> E-Mail: aye...@wso2.com <ayshsa...@gmail.com> >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Sajith Janaprasad Ariyarathna >>>>>>>>>> Software Engineer; WSO2, Inc.; http://wso2.com/ >>>>>>>>>> <https://wso2.com/signature> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Sajith Janaprasad Ariyarathna >>>>>>>> Software Engineer; WSO2, Inc.; http://wso2.com/ >>>>>>>> <https://wso2.com/signature> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Dev mailing list >>>>>>>> Dev@wso2.org >>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> >>>>>>>> Nipuna Marcus >>>>>>>> *Software Engineer* >>>>>>>> WSO2 Inc. >>>>>>>> http://wso2.com/ - "lean . enterprise . middleware" >>>>>>>> Mobile : +94 (0) 713 667906 <+94%2071%20366%207906> >>>>>>>> nipu...@wso2.com >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Dev mailing list >>>>>>>> Dev@wso2.org >>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Nipuna Marcus >>>>>> *Software Engineer* >>>>>> WSO2 Inc. >>>>>> http://wso2.com/ - "lean . enterprise . middleware" >>>>>> Mobile : +94 (0) 713 667906 <+94%2071%20366%207906> >>>>>> nipu...@wso2.com >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> Dev@wso2.org >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> *Ruwan Abeykoon* >>>>> *Associate Director/Architect**,* >>>>> *WSO2, Inc. http://wso2.com <https://wso2.com/signature> * >>>>> *lean.enterprise.middleware.* >>>>> >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> Dev@wso2.org >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>>> >>>> -- >>>> Nuwan Dias >>>> >>>> Software Architect - WSO2, Inc. http://wso2.com >>>> email : nuw...@wso2.com >>>> Phone : +94 777 775 729 <+94%2077%20777%205729> >>>> >>>> _______________________________________________ >>>> Dev mailing list >>>> Dev@wso2.org >>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>> >>>> >>> >>> >>> -- >>> >>> Best Regards, >>> >>> Nuwandi Wickramasinghe >>> >>> Software Engineer >>> >>> WSO2 Inc. >>> >>> Web : http://wso2.com >>> >>> Mobile : 0719214873 >>> >> >> >> >> -- >> >> *Ruwan Abeykoon* >> *Associate Director/Architect**,* >> *WSO2, Inc. http://wso2.com <https://wso2.com/signature> * >> *lean.enterprise.middleware.* >> >> > > > -- > Nuwan Dias > > Software Architect - WSO2, Inc. http://wso2.com > email : nuw...@wso2.com > Phone : +94 777 775 729 <+94%2077%20777%205729> > -- Chanaka Jayasena Associate Tech Lead, email: chan...@wso2.com; cell: +94 77 4464006 blog: http://chanaka3d.blogspot.com
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev