Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I control the localization files #708

Closed
mcfedr opened this issue Aug 27, 2016 · 17 comments · May be fixed by qcif/data-curator#563
Closed

Can I control the localization files #708

mcfedr opened this issue Aug 27, 2016 · 17 comments · May be fixed by qcif/data-curator#563

Comments

@mcfedr
Copy link

mcfedr commented Aug 27, 2016

  • Version: 5.35
  • Target: MAS

The electron zip file contains 100s of language.lproj folders, and this causes the mac app store to list the app as being available in all of these languages.

  1. Would electron build be interested in adding code to allow me to choose which of these folders to leave and which to remove?
  2. Or is these a hook that I can run some code between the files being prepared and before they are packaged and code signed? That way I could write project specific code to clean up these folders, and potentially make other changes, this could be a more generic solution
@develar
Copy link
Member

develar commented Aug 27, 2016

You can use afterPack, but if you can write code, it is better to prepare PR instead of hack on your side.

Would electron build be interested in adding code to allow me to choose which of these folders to leave and which to remove?

Yes, files currently affects only app code, not electron distribution. Maybe electronFiles?

@develar
Copy link
Member

develar commented Aug 27, 2016

Do you know, for what so many empty language.lproj directories? Maybe we can just leave en.lproj and electronFiles will allow to add another if need?

@develar develar added the mac label Aug 27, 2016
@develar
Copy link
Member

develar commented Aug 27, 2016

electron/electron#2484

@mcfedr
Copy link
Author

mcfedr commented Sep 1, 2016

For the moment I am adding quick fix to my gulp task. I'm going to put it here for reference. If I find some time ill try and make a pull request.

let languages = ['en'];
electronBuilder.build({
    platform: getElectronPlatforms(),
    devMetadata: {
        build: {
            afterPack: ({appOutDir, options}) => {
                return new Promise((res, rej) => {
                    console.log('afterPack', appOutDir, options.platformPackager.platform);
                    if (options.platformPackager.platform.name === 'mac') {
                        let glob = require('glob'),
                            del = require('del');
                        glob(`${appOutDir}/${options.appInfo.name}.app/Contents/Resources/!(${languages.join('|')}).lproj`, (err, files) => {
                            if (err) return rej(err);
                            del(files).then(res, rej);
                        });
                    } else {
                        res();
                    }
                });
            }
        }
    }
})

@develar
Copy link
Member

develar commented Sep 1, 2016

Do you like electronFiles solution?

@mcfedr
Copy link
Author

mcfedr commented Sep 1, 2016

I'd probably be more inclined to add a list of languages as a setting, that's why I put languages as a variable in that code.

I think it might be hard to get electron to remove the default ones.

@fab1an
Copy link

fab1an commented Sep 16, 2017

Is there a way of doing this without afterpack? I'm not using the programmatic api, and I don't want to start using it because of that (I run my build using gradle/kotlin, so no easy javascript support there).

@develar
Copy link
Member

develar commented Sep 16, 2017

@fab1an for what?

@fab1an
Copy link

fab1an commented Sep 16, 2017

Never mind, I just added a .js-file to my build for now.

@develar develar reopened this Sep 17, 2017
@develar
Copy link
Member

develar commented Sep 17, 2017

Reopened — requested by 2 VIP users is enough to implement.

@develar
Copy link
Member

develar commented Jan 31, 2018

Implemented. mac.electronLanguages Set to array of lang codes. e.g. ["en", "bn"]

@perryy
Copy link

perryy commented Nov 5, 2018

Hello, can I ask you why electron-builder does not accept pt-BR, zh-TW or zh? Is there any reason for that?
Thank you

@perryy
Copy link

perryy commented Nov 5, 2018

I have figured out, that I have to use pt_BR, zh_TW and so on. Sorry for bothering you

@fabiospampinato
Copy link

Reopened — requested by 2 VIP users is enough to implement.

@develar Are VIP users still a thing? If yes how does one become a VIP user?

@linonetwo
Copy link

I have this set:

    "packagerConfig": {
        "icon": "build-resources/icon.icns",
        "asar": {
          "unpack": "**/.webpack/main/0.index.worker.js"
        },
        "extraResource": [
          "localization",
          "template/wiki"
        ],
        "mac": {
          "category": "productivity",
          "target": "dmg",
          "icon": "build-resources/icon.icns",
          "electronLanguages": [
            "zh_CN",
            "en",
            "ja"
          ]
        }
      },

But there are still lots of lproj files

Screen Shot 2021-05-04 at 01 43 22

@pravichandran15
Copy link

electronLanguagues with list of array / null is working fine with electron-builder : 23.3.3

@alon42
Copy link

alon42 commented Jul 15, 2024

Have the same problem:
"electron-builder": "24.13.3",

it seems like a bug in electron builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants