mozilla-mobile / firefox-ios

Firefox for iOS
Mozilla Public License 2.0
12.2k stars 2.92k forks source link

Automate the process to import strings #10293

Closed isabelrios closed 2 years ago

isabelrios commented 2 years ago

Currently there is no way to import strings automatically as described in the wiki. After running ./bootstrap --importLocales there are logs in the terminal but nothing is changed in the end, git diff returns nothing.

In addition to fixing that, it would be nice to run this process automatically and have a PR created when there are string changes. That solution is implemented already in Focus-iOS as well as on android projects.

┆Issue is synchronized with this Jira Task

isabelrios commented 2 years ago

Some questions...

  1. Eveng though zgh locale was imported a few weeks ago, see PR, it still is being imported when running the process. Then it was removed in https://github.com/mozilla-mobile/firefox-ios/pull/10102/files. Just to confirm we don't want it so that we can ignore it.

  2. There is a change in the Client/br.lproj/InfoPlist.strings that I don't understand why is happening. Where can I see the place that change takes place?That's happening for all locales:

    
    +++ b/Client/af.lproj/InfoPlist.strings
    @@ -1,7 +1,7 @@
    /* Privacy - Camera Usage Description */
    "NSCameraUsageDescription" = "Hierdie laat mens foto’s neem en oplaai.";

-/ Privacy - Location When In Use Usage Description / +/ file, You can obtain one at http://mozilla.org/MPL/2.0 / "NSLocationWhenInUseUsageDescription" = "Webwerwe wat u besoek kan dalk u ligging vra.";


`**Privacy - Location When In Use Usage Description**`  is changed by  `**file, You can obtain one at http://mozilla.org/MPL/2.0**` 

In the end, see example of automatic PR created https://github.com/isabelrios/firefox-ios/pull/1 (take into account that it is running after the latest import done, so no new strings appear)
isabelrios commented 2 years ago

Another example of PR without importing the zgh locale: https://github.com/isabelrios/firefox-ios/pull/2/files

@lmarceau do you know why the files are changing that instead of actually translate strings? I know there might not be new strings but don't understand that change I'm seeing. Running locally the LocalizationTools project, I see the same changes

lmarceau commented 2 years ago

@isabelrios you mean for point 2 about the NSLocationWhenInUseUsageDescription ? I tried to fix it as my first idea was that the note in the .xliff was wrong in the firefoxios-l10n project. But even after fixing it there it still imports the wrong string /* file, You can obtain one at http://mozilla.org/MPL/2.0 */ 🙈 I'm not sure where this is coming from.

isabelrios commented 2 years ago

Thanks @lmarceau, yeah, I mean that point and that string... strage it is being changed. Let's ask @Delphine in case she knows :) or can point us the the correct place to look at... That's the only thing I would need to fix to have the automated process running.

isabelrios commented 2 years ago

I don't know where the issue is caused, but I have opened an issue in firefoxios-l10n: https://github.com/mozilla-l10n/firefoxios-l10n/issues/132 in case we get more help to get to the bottom of this.

isabelrios commented 2 years ago

Looks like the problem is in the LocalizationTools code. If instead of that I use the copy we have in focus, modified to work on firefox, then the import works correctly, not modifying that unexpected line.

Once we know that, I will check what's done differently to make that work incorrectly.

isabelrios commented 2 years ago

Actually, the issue is not with the scripts either... it is due to this file: Client/en.lproj/InfoPlist.strings https://github.com/mozilla-mobile/firefox-ios/blob/463f6998e7b58963848d2c32a06f37fb1e16a8ed/Client/en.lproj/InfoPlist.strings#L3

We are taking the line just before the NSLocationWhenInUseUsageDescription which is: // file, You can obtain one at http://mozilla.org/MPL/2.0

After removing those lines, the import works fine 🎉

Delphine commented 2 years ago

Sorry for coming in late, and THANKS so much for this! Just confirming that zgh locale should be included both in builds and screenshots (like in other mobile products, we want to import / launch any locale as soon as they start out working on Pontoon). There were issues running into that locale, and I believe @dnarcese filed a Jira ticket for that (but I couldn't find it). LMK if there is anything else pending! thanks

lmarceau commented 2 years ago

@Delphine Yes there's a ticket for zgh here: https://github.com/mozilla-mobile/firefox-ios/issues/10104 We wanna take the time to make this work and include it back into the project!

Delphine commented 2 years ago

Thanks for confirming Laurie! I understand this needs time and there are more priority items. I'll stay tuned for this (could it at all be related to what Isabel mentioned? No idea TBH)

lmarceau commented 2 years ago

The Tamazight language had some issues when we uploaded the build to the App Store. I haven't work on this so I'm not sure what were the exact reasons, let's hope this time we can fix it 😬 Tamazight task is scheduled at the moment to be worked on soon! 🤞

isabelrios commented 2 years ago

@lmarceau for the automation to work for zgh locale, it has to be added back to the shipping-locales.txt file.

lmarceau commented 2 years ago

I'll add this in the other task then !

isabelrios commented 2 years ago

Closing this as there are automatic PRs created daily after running the import-string.sh script