Thank you Ben for such a thoughtful answer and some great insights.

Geoff

> On 12 Mar 2024, at 6:32 pm, Ben Weidig <b...@netzgut.net> wrote:
> 
> Hi Geoff,
> 
> we translated a Tapestry app for one of our customers in recent years but
> don't have a ready-to-deploy workflow...
> But I can share our experiences and how we managed to do it in the end.
> 
> Tools like poedit or plugins for IDEs are great tools, but only if both
> sides use them.
> Still, they often change the order of lines or the formatting just a bit,
> which results in many unnecessary changes in Git and makes it harder to
> track the actual progress.
> 
> The most important question when using a third-party translator is what
> kind of files they expect to receive for translation and how you receive
> them back.
> We looked into different services, and most are quite pricey and not
> flexible in their workflow or tooling.
> That's understandable, but for smaller translation projects, it's just too
> much friction...
> 
> Instead of an agency/full-service, we ended up using multiple freelancers
> who we could create a custom workflow with.
> 
> We wrote two scripts to export all property files of a language into a
> single CSV, so they could use Excel for doing the translation *shudder* but
> that was most people's easiest tool to use.
> Then, they exported it as CSV again (or we converted the XLS ourselves),
> and we imported it with another script.
> 
> 
> If your translation people can work directly with the property files, you
> could copy the resources folder and remove all non-properties with
> 
> find -not -name '*.properties' -type f -delete
> 
> and then create an ZIP archive, send it to them, they translate it, zip it
> up again, you copy it back, check in Git the changes.
> 
> However, such manual approaches don't provide much additional info like "is
> everything translated" or marking any problems.
> 
> To solve the latter, the translators could add comments like "# TODO: ..."
> directly into the file.
> Many tools detect TODO/FIX/etc., like the "Todo Tree" extensions by
> "Gruntfuggly" for Visual Studio Code.
> 
> 
> Another useful tool for finding missing translations and text that wasn't
> moved to a property file yet is advising the PropertyFilesParser.
> 
> The following code adds the language of the property file a text was loaded
> from.
> 
> @Advise(serviceInterface = PropertiesFileParser.class)
> public static void advisePropertiesFileParser(MethodAdviceReceiver receiver,
> 
> @Symbol(PROPERTIES_DISPLAY_LOCALE) boolean displayLocale) throws
> NoSuchMethodException,
> 
>                            SecurityException {
> 
>    if (displayLocale == false) {
>        return;
>    }
> 
>    Method method =
> PropertiesFileParser.class.getMethod("parsePropertiesFile", Resource.class);
> 
>    Pattern pattern = Pattern.compile(".+_(.[a-zA-Z]{1,3})\\.properties");
> 
>    receiver.adviseMethod(method, advice -> {
>        advice.proceed();
>        Object returnValue = advice.getReturnValue();
>        if (returnValue == null || returnValue instanceof Map == false) {
>            return;
>        }
> 
>        @SuppressWarnings("unchecked")
>        Map<String, String> values = (Map<String, String>) returnValue;
> 
>        Resource resource = (Resource) advice.getParameter(0);
>        if (resource == null) {
>            return;
>        }
> 
>        String file = resource.getFile();
>        if (file == null) {
>            return;
>        }
> 
>        Matcher matcher = pattern.matcher(file);
>        String suffix = matcher.matches() ? " [" + matcher.group(1) + "]" :
> " []";
>        for (var key : values.keySet()) {
>            values.put(key, values.get(key) + suffix);
>        }
> 
>        advice.setReturnValue(values);
>    });
> }
> 
> 
> Overall, it's still a hacky and manual workflow, but it works for us quite
> well and was way cheaper than going the agency/full-service route.
> Any new translations are usually done by sending the new base property
> files of an added component or page to the translators.
> 
> 
> Cheers
> Ben
> 
> On Tue, Mar 12, 2024 at 12:05 AM JumpStart <
> geoff.callender.jumpst...@gmail.com> wrote:
> 
>> Hi all,
>> 
>> I need to provide a new translation for my app and then keep it
>> maintained, and I’ll need to use a third-party to do the translation, but I
>> don’t want to give them access to the entire project’s source.
>> 
>> Instead, I presume what’s needed is automatic extraction of all the
>> .properties files that have the right language extension (and a few
>> English .tml files), get them translated, and then automatically write back
>> to the right places.
>> 
>> Does anyone have a good workflow for this? Does it involve poedit?
>> 
>> Cheers,
>> 
>> Geoff
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to