crowdin / mobile-sdk-ios

Crowdin iOS SDK delivers all new translations from Crowdin project to the application immediately
https://crowdin.github.io/mobile-sdk-ios
MIT License
117 stars 43 forks source link

Access Markdown files via Over-the-air content delivery. #186

Closed stevi-clue closed 2 years ago

stevi-clue commented 2 years ago

Hello

I noticed that via the Tools -> Over-the-air(OTA) content delivery -> Distributions, we can select and release files that are not only Localizable.strings, but also .mdown files. Reading through the documentation, I saw that the the OTA content delivery does not change existing files or add new files, which means that they don't exist in the file system of the project when running the app. I am wondering how we can access the content of these .mdown files in the iOS project that have been released via OTA?

Many thanks!

andrii-bodnar commented 2 years ago

Hi @stevi-clue!

Currently, the iOS SDK works only with iOS-related file types (strings, stringsdict, xliff).

Could you please describe your use case? Why do you need to access markdown files in your iOS app?

stevi-clue commented 2 years ago

Thanks for the fast reply!

In the project that we are working on, we are currently in the process of decoupling the engineering from the localization work so that someone without iOS knowledge can add new/update and release strings without requiring a new iOS version release. This works great by using Localizable.strings, but we also have some other types of use cases.

One of them is displaying larger texts with annotations for which we want to have a neutral format that can be used and rendered by both iOS and Android. To achieve this we use .mdown files.

andrii-bodnar commented 2 years ago

@stevi-clue, thanks a lot for the details provided!

Actually, you can select any file for a release in distribution and there is a possibility to manually access these files - Content Delivery

stevi-clue commented 2 years ago

Thanks for the link! The instruction for manual access is only mentioned in the Web Application section, but I assume that this should also work if we fetch those files from iOS and Android via HTTP request?

andrii-bodnar commented 2 years ago

@stevi-clue right, it will work in this case

stevi-clue commented 2 years ago

I tried to get the file using https://distributions.crowdin.net/{distribution_hash}/content/{path_to_file} as described in Content Delivery docs with the distribution hash value from the project, but I am getting error code 403 AccessDenied.

I also generated a Personal Access Token and added it in the header like Authorization: Bearer <ACCESS_TOKEN> like described in the API documentation, but it doesn't seem to work as well. On the other side if I use another request URL like https://api.crowdin.com/api/v2/projects/{project-id}/files/{file-id} it seems to work.

Am I missing something?

andrii-bodnar commented 2 years ago

@stevi-clue access token is not needed here. Probably the content path is wrong (403 is an incorrect status code for this case, but it's AWS returning this code).

Could you please specify your distribution hash? In case you are concerned about your distribution data, it's a better idea to share this hash using the contact form with a specifying this issue.

stevi-clue commented 2 years ago

Thanks! I will try to change the path and let you know how it goes.