Can anyone suggest how can I translate the dynamic data to different language which comes from remote API? - flutter

I am using flutter_localozation for localizing my app creating .arb files for different languages. However, I am not able to localize the data coming from API, how can I do so?

I am not aware of this kind of translation but I would like to suggest you - If possible try to add one parameter in api - which represents selected language and based on that you will get response from API. For this you have to implement translation in database as well. For some static strings you can manage it from app side and for dynamic response it will be manage using database.

According to me if possible, get translated JSON response based on the selected language from Backend.
Because by doing this, you can reduce translating stuff from the App side.

Related

How can I use my own api to other platforms?

I made a json api with using this => https://www.django-rest-framework.org/tutorial/quickstart/
All the articles I read teach the creation and use of api within its own platform, what I need is what I produce on the web, use it to in other platforms. I made my api but no idea about how to import it in other platforms..
so how can I use my own api in my c# windows form application or my flutter project
Any link, guide etc.
First of all you should be clear about why you need an api. If you need to transfer data from one system to another, pick a way that you know you can operate on both sides.
JSON or XML are just ways of representing data, first think about what you need and how can you transport that data between systems...After that the implementation should be clear.

Api to Api Comunication and data transformation

Good day,
I want to communicate between two Web Api's, the first web api lets call Api1 not written by me and that api interacts with my data base to spit out information needed.
I have web api2 which would be written by me and why i have this is because my application needs data in certain kind of format (.dll) format.so api2 purpose is to get the information from api1 and then transform or package my data in a way that the my application would understand.
The question, is this possible?. can i use wrappers, so when i get my information from api1 then i wrap my information in the desired format before sending it off to the application. Does anyone have any other suggestions ?
Thank you in advance,
What you describe is possible but the requirements are too vague to give a useful answer.
The file extension doesn't really mean anything so not sure why you need .dll format for the message. I would use a standard format like Json or Xml. Or if using datawindow you could simply do saveas on sending side (or comma delimited, tab delimit) and file import on receiving end, so many options.
Too vague.
Async or Sync interface?
Files transferred via REST, OLE, DDE, or files written to location on server?
Are the files/data transferred specific to a logged in user?
How much data is being transferred, rows of information or configuration data? Answer will help in deciding on appropriate format & best method.
What type program is API #1 not in your control? That is important factor.

How to integrate localization (i18n) so that it scales with a React application?

I am currently looking at various i18n npm packages and most seem to insist that the translations are stored in a flat file, e.g. .json formatted file. My questions is whether this has a performance overhead that would be greater then storing the languages in a database, e.g. MongoDB.
For example, if I have 10,000 translations (we will assume that in this particular application only one language file will be needed at a time, i.e. most will be using the application in English and some users may want to set the application to use a different language.) then this will equate to approximately 200kb of data to download before the application can even start being used.
In a React application, a suggested design pattern is to load data using container components, that then pass data to 'dumb' child components. So, would it not make sense to also load translations in the same manner, i.e. group the translations into usage, or by component, so that the data is sent down the wire only when needed, say, from a call to MongoDB?
I would integrate it in your API. That means you can create e.g. a REST or GraphQL API, which handles this for you. In i18n, it is often reasonable to store the data in a hierarchy. This means you can split your translations in different categories (like pages) and simply request those translations, which you really need.
I really like the way of doing it in the react-starter-kit. In this example, you find how they handle it with a GraphQL API and only request those translations, which are really required for rendering the page. Hope this helps.
Important files of the i18n implementation of the react-starter-kit:
GraphQL Query: https://github.com/kriasoft/react-starter-kit/blob/feature/react-intl/src/data/queries/intl.js
Example component implementation: https://github.com/kriasoft/react-starter-kit/blob/feature/react-intl/src/components/Header/Header.js
Of course if you have this amount of translations, I would use a database for a better system usage (in the react starter kit, they use simple file storage which is not really usable with so many translations). A mongodb would be there my first choice, but maybe this is only my own preference of flexibility and own knowledge.
Obviously, you don't want each and every language to be loaded on the client. My understanding of the pattern you described is to use a container component to load the relevant language for the whole app on startup.
When a user switches language, your container will load the relevant language file from the server.
This should work just fine for a small/medium app but has a drawback : you'll need another request to the server after the JS code has loaded to load the i18n data.
Another way to solve this is to use code splitting (and possibly server side rendering) techniques which could allow this workflow :
Server builds a small bundle containing a portion of the i18n data
Client loads the rest of your app code and associated i18n data on demand, as the user navigates through your app
If not yet done having a look at https://react.i18next.com/ might be a good advice. It is based on i18next: learn once - translate everywhere.
Your code will look something like:
<div>{t('simpleContent')}</div>
<Trans i18nKey="userMessagesUnread" count={count}>
Hello <strong title={t('nameTitle')}>{{name}}</strong>, you have {{count}} unread message. <Link to="/msgs">Go to messages</Link>.
</Trans>
Comes with samples for:
- webpack
- cra
- expo.js
- next.js
- storybook integration
- razzle
- dat
- ...
https://github.com/i18next/react-i18next/tree/master/example
Beside that you should also consider workflow during development and later for your translators -> https://www.youtube.com/watch?v=9NOzJhgmyQE

Displaying web based visualisation or graphing of data based on a postgresql database?

I am working on a web application for a client that uses a postgresql database. I want the client to be able to go to a certain area of the site where the data from the database is displayed in graph form (for example, sales figures over a 6 month period). Is there a plugin I could use for this (I don't have any experience of this, so an easy one, or one with tutorials available would be great). I had a look at BIRT, which says it has a web based option but I couldn't really figure it out. I don't want the client to have to download and go through another program, I just want them to go to a url within their site, and it's all just presented to them there and then.
Any sort of pointers in the right direction would be greatly appreciated.
Thank you.
HighCharts, at http://www.highcharts.com/, works well for this case -- I use it fairly often. It supports Ajax data feeds in JSON format, so you can write an endpoint which returns the JSON representing the data from Postgres and which gets called from a JavaScript function which creates the graphs using that data (you would place that call in a ready function).
Also, if you're using Postgres 9.3 or higher, it supports JSON natively, so you can do the JSON conversion in the SQL query itself, as opposed to post-processing the results in your Python or other backend code.
Highcharts is reasonably flexible and allows for a variety of nice-looking, functional charts and graphs. If you want to get much fanicer, d3 may be worth a look. These are some the types of graphs/charts it can do: https://github.com/mbostock/d3/wiki/Gallery
I have not used d3 myself, however.
For the scenario you described above, Highcharts seems like it would work just fine.
It's been a while, and a lot has happened since 2016. There is now ChartJS as well - http://chartjs.org/, for example, which is easier to use than HighCharts and very flexible (I've used both).
What they both don't do is dynamic data. If you want that your client decides which data he wants to watch - that part you need to write yourself.

Getting only desired data from the web

I am working on web base application in ios.I want to get only the desired data from the web .
for e.g. If there is a site which showing the information of train code , train schedule, seat availability i want to get the data related to only seat availability from that web page and render it to my own table. Is it really possible ?
I am not an iOS developer, so I can't give you code on how to do it.
You'll be needing an HTML parser. The process is commonly called web/screen scraping. Have a read at this: https://stackoverflow.com/a/3541965/459338
You can use a HTML Parser or use Regex to extract the pattern of the data that you want from the given url . However try to check whether the data provided by the website is copyrighted or not else you cannot use their data publicly via another interface without their permission.
Yes it is possible. For doing this you will be using the method of Parsing . Depending on the type of API you are getting whether it is JSON, XML or HTML etc , you can parse the desired data accordingly. You can check for the API's on the web for the type of information you would want to parse. Otherwise the database option is always there.