Hello everybody, I have open-sourced my Gradle pl...
# feed
l
Hello everybody, I have open-sourced my Gradle plugin that allows you to export/convert the strings in a Google Sheet into resource files for Android and Kotlin Multiplatform apps. https://github.com/litrik/gsheet-resources
๐Ÿ‘ 6
โค๏ธ 1
๐Ÿ‘๐Ÿป 1
K 6
s
"Crowdin hates this trick." ๐Ÿ˜‰ Sometimes itโ€™s really just the small things. ๐Ÿ˜„ Thanks for sharing! ๐Ÿ™‚
๐Ÿ‘ 1
u
Itโ€™s really well thought out :) Iโ€™m still a bit worried that it might be quite fragile โ€” does it rely on scraping?
l
It uses the standard Google Sheet function to export any public sheet as a CSV file:
Copy code
"<https://docs.google.com/spreadsheets/d/${sheetId}/export?format=csv&gid=${tabId}>"
u
Ah, thatโ€™s great โ€” I donโ€™t know Google Sheets export function :) Iโ€™m going to use it!
๐Ÿ‘ 2
l
I've been using this code internally for several years (for multiple apps/customers). The CSV export of Google Sheets has been very stable over all these years.
๐Ÿ’ฏ 1
๐Ÿ‘ 1
u
Thanks for open-sourcing it!
๐Ÿ‘ 1
d
Did something similar a many year back but a command line utility. Maybe it can give some inspiration on how to handle quantitive strings as well. ๐Ÿ™‚
๐Ÿ‘ 2
b
Super cool @litrik! I implemented basically the same thing at my job as well for internal use ๐Ÿ˜ Have you managed find or think about a way to support plurals as well?
l
I typically define my plurals in a separate resource file and point to the strings in the generated resources. So, assuming
strings_generated.xml
contains strings like
event_days_left_one
and
event_days_left_other
(generated from the Google Sheet), I would add the following to the main
strings.xml
to define the plurals:
Copy code
<plurals name="event_days_left">
    <item quantity="one">@string/event_days_left_one</item>
    <item quantity="other">@string/event_days_left_other</item>
</plurals>
Maybe I can implement something similar to what @David did in the tool he mentioned above.
๐Ÿ‘ 1
@Benni H. I've added support for plurals in a new 0.4.0 release. See https://github.com/litrik/gsheet-resources/tree/v0.4.0?tab=readme-ov-file#plurals
๐Ÿ‘Œ 2
b
Very nice (and fast) ๐Ÿ˜
l
After reading my own explanation how I was doing plurals, I realized that it can be automated (as long as you follow a few rules for the IDs). ๐Ÿคท