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

Localization support #39

Open
AndreasJJ opened this issue Aug 12, 2024 · 1 comment
Open

Localization support #39

AndreasJJ opened this issue Aug 12, 2024 · 1 comment

Comments

@AndreasJJ
Copy link

I am pretty new to coding in swift and with xcode, but it seems like you should be able to localize fairly easily by having a Localizable.xcstrings (as long as it's properly linked to project file and target).

I tried having a Localizable.xcstrings file in my /targets/foo folder, but as expect from the readme the file isn't properly linked up. I also tried add it to a /targets/foo/assets/ folder, and while that does somewhat add it to the project as an asset, but it doesnt seem to be linked in as a localization file. I am not sure if i am doing something wrong or if xcstrings files aren't supported by this plugin.

I have already created a plugin that sits on top of this plugin and takes in our localization structured json files and converts it to a Localizable.xcstrings file, but linking it up into the target was a bit more challenging as someone who's not very familiar with how xcode works under the hood.

@AndreasJJ
Copy link
Author

I wasn't able to figure out how to write my own plugin on top of this that would add the localization file, as i had some problems getting the correct target (I wonder if my plugin was running before this one in the chain).

However, I was able to make it work by making a simple patch for this npm package with patch-package 8.0.0.

diff --git a/node_modules/@bacons/apple-targets/build/withXcodeChanges.js b/node_modules/@bacons/apple-targets/build/withXcodeChanges.js
index ef64d1b..ef25c8e 100644
--- a/node_modules/@bacons/apple-targets/build/withXcodeChanges.js
+++ b/node_modules/@bacons/apple-targets/build/withXcodeChanges.js
@@ -745,6 +745,7 @@ async function applyXcodeChanges(config, project, props) {
         // All assets`
         // "assets/*",
         // NOTE: Single-level only
+        "*.xcstrings",
         "*.xcassets",
     ]
         .map((glob) => (0, glob_1.sync)(glob, {

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

No branches or pull requests

1 participant