Silencing new Xcode 10.2 Localization warning

21 views
Skip to first unread message

Mark Callow

unread,
Apr 4, 2019, 3:01:54 PM4/4/19
to gyp-developer
Xcode 10.2 throws a new warning "Localization" on all my gyp-generated projects. It asks if you want to "enable Base Internationalization".

The way this is done is by inserting

    knownRegions = (
      en
,
     
Base,
   
);

into the PBXProject section of the .pbxproj file. I tried adding

'knownRegions': 'en Base',

to my global xcode_settings but gyp adds that to build settings for all configurations and that does not satisfy Xcode.

Does anyone know how to get gyp to add this to the PBXProject section?

Note that if you tell Xcode to enable Base Internationalization but then revert to the previous project file, Xcode will not throw the warning until the next time it is restarted. It seems to have some kind of internal flag that shuts down the warning even if the project is reloaded from a file that does not have BI enabled.


TJ Grant

unread,
Apr 13, 2019, 10:23:11 AM4/13/19
to gyp-developer, Mark Callow
Hi Mark-- I looked into this…

So long story short, 'knownRegions' is something that lives at the top level PBXProject object, not the xcode_settings level; and unless I'm mistaken, it's not possible to write a gyp key to configure at that level.

You can, for now, modify xcodeproj_file.py at around line 2583 after the line that says:

_schema.update({

And add the following line:

    'knownRegions':           [0, list,                 0, 1, ['en', 'Base']],

(You'll see other similar "default" lines there.)
If you make this change, it will set this as the default for all Xcode projects generated, and in my testing, this sets the key properly and silences the new warning. 

That said, I'm of the opinion this should probably be user configurable, but I'll make add a ticket to the two gyp ticket trackers and see what the key players think.

--Terence


--

---
You received this message because you are subscribed to the Google Groups "gyp-developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gyp-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TJ Grant

unread,
Apr 13, 2019, 11:00:12 AM4/13/19
to gyp-developer, Mark Callow
Added this to GYP's ticket tracker:

Made a PR for GYP3's (apologies for the weird branch name):

Best regards,
--Terence J. Grant
tjg...@tatewake.com

Mark Callow

unread,
Apr 18, 2019, 10:35:43 PM4/18/19
to gyp-developer


On Saturday, April 13, 2019 at 7:23:11 AM UTC-7, TJ Grant wrote:
Hi Mark-- I looked into this…

So long story short, 'knownRegions' is something that lives at the top level PBXProject object, not the xcode_settings level; and unless I'm mistaken, it's not possible to write a gyp key to configure at that level.

Yes. I had come to the same conclusion.


You can, for now, modify xcodeproj_file.py at around line 2583 after the line that says:

_schema.update({
 

And add the following line:

    'knownRegions':           [0, list,                 0, 1, ['en', 'Base']],

I actually did that before I saw your message. I also added the line

    'developmentRegion':      [0, str,                 0, 1, 'en'],

which Xcode was adding when I told it to update the project.


That said, I'm of the opinion this should probably be user configurable, but I'll make add a ticket to the two gyp ticket trackers and see what the key players think.


I agree. I expect some people would not be happy having "en" hardwired, especially for the developmentRegion. Actually since you say just knownRegions silences the warning, I should probably remove developmentRegion for now.  However, if it was user configurable, I think it would be a good thing to include. Thanks for opening the tickets.
Reply all
Reply to author
Forward
0 new messages