Comments (11)
Any further progress on this?
from core.
Wow, nice work on that topic! It looks good!
There is just one thing that hurts me: a resource is represented by an URL, so a translation is not a resource by itself but just a part of a resource. So what about issuing a PUT
request to remove a lang but not the whole resource as it's just the modification of an existing resource?
3 other small questions:
- How the language support will be described in the Hydra vocab?
- Is an integration with DoctrineExtensions / DoctrineExtensionsBundle planned? How they will fit together?
- What do you think about sending a mail on the Hydra or JSON-LD mailing-list to be sure that everything is OK from a spec point of view?
Cannot wait to see the code 😅
from core.
Yeah, it's a good point of view for the PUT section.
Maybe to remove a translation use DELETE with a new endpoint ? Like the last point.
- How the language support will be described in the Hydra vocab?
I don't know, it's a real interrogation for me ...
- Is an integration with DoctrineExtensions / DoctrineExtensionsBundle planned? How they will fit together?
I think the base dev must be independant of these bundle. But we must propose an implementation to use these bundle quickly and simply.
- What do you think about sending a mail on the Hydra or JSON-LD mailing-list to be sure that everything is OK from a spec point of view?
Good idea, but where is the M-L ?
from core.
I study another possibility to provide the i18n support on a resource.
To add a collection of translation when needed.
For example :
GET http://api.example.com/countries/1?locale=fr-FR
{
"@context": "http://schema.org",
"@type": "Country",
"@id": "/countries/1",
"@language": "fr-FR",
"nonLocalizedAttribute": 10,
"localization": {
"@type": "CountryLocalization",
"@id": "/country_localization/1/fr-FR",
"name": "Angleterre"
}
}
GET http://api.example.com/countries/1
{
"@context": "http://schema.org",
"@type": "Country",
"@id": "/countries/1",
"nonLocalizedAttribute": 10,
"localizations":{
"en": {
"@type": "CountryLocalization",
"@id": "/country_localization/1/fr-FR",
"name": "Angleterre"
},
"fr-FR": {
"@type": "CountryLocalization",
"@id": "/country_localization/1/fr-FR",
"name": "England"
}
}
}
This way he simpler for many reasons, but I think it's not very JSON-LD / Hydra compliant.
It's simpler because :
- you cut the "localized" part of the resource into separate resource, wich can be managed like other resources.
- "Like the DB storage"
It's not JSON-LD / Hydra compliant because :
- you change structure of object ( localization / localizations attribute is dynamical ... ), you cannot use schema.org vocabulary because of that
What do you think about this ?
from core.
@dunglas if you want to view, here is my work but still in dev : https://github.com/MLKiiwy/DunglasApiBundle/tree/tdd-i18n-support
from core.
Nice to see progress on that :)
I prefer to keep with the standard: it's the only way to be interoperable with other systems (client-side JSON-LD / Hydra libraries, search engines...).
Maybe the best thing to do is to create thread on the Hydra working group about that. You can register to the mailing list on the Hydra website (you just need a W3C account): http://www.hydra-cg.com/
from core.
@MLKiiwy very interesting approach to handle localized content.
@dunglas is there any plan to include this enhancement in the bundle?
from core.
@MLKiiwy have you gone further with this ?
from core.
No sorry, I stop my development on this part because I don't need it anymore :/ but the solution is still valid but must be implement in the new version of api-platform core. maybe as a plugin ...
from core.
Is this the "front line" regarding API Platform and I18N or am I missing something somewhere?
from core.
No it was an old subject. I will close this.
from core.
Related Issues (20)
- cannot perform GraphQL sub-selections on non-doctrine resource collections HOT 10
- `property` field of FilterInterface::getDescription - string only? HOT 5
- Validation from DTO before resolver HOT 14
- Swagger Docs jsonopenapi format return HTML HOT 5
- Mixing IRIs between resources and sub-resources when using DTO HOT 2
- Doctrine ODM SearchFilter with embedded documents HOT 3
- Asset mapper warnings HOT 9
- Attempted to call an undefined method named "withParameterName" of class "ApiPlatform\Metadata\ApiProperty" HOT 1
- OpenAPI on calculated field add an extra `items` fields even if `openApiContext` define an object HOT 3
- Validation doesn't work proppperly with strict types HOT 1
- Add a way to configure default strategy mode for the SearchFilter
- Handle null request in ReadProvider HOT 1
- Upgrade to Symfony 7.1 seems to be breaking container linting
- Broken with symfony 7.1 HOT 2
- Unable to generate an IRI for the item of type App\ApiResource\*** with an UriTemplate HOT 1
- Support for JsonProblem (RFC 7807) Extension Member HOT 2
- Remove hydra prefix
- Filters incompatible with PHP 8.2.20 and 8.3.8 HOT 22
- Implement getType for ODM DoctrineExtractor HOT 1
- Mixing REST and GraphQL operation names HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.