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

iOS .strings file incorrectly assumes UTF16-LE encoding #903

Closed
LucaFagan opened this issue May 15, 2018 · 10 comments
Closed

iOS .strings file incorrectly assumes UTF16-LE encoding #903

LucaFagan opened this issue May 15, 2018 · 10 comments
Labels
[Type] Bug An existing feature is broken.
Milestone

Comments

@LucaFagan
Copy link

I've installed the plugin, created the project and then imported a .strings file.

Translation list is empty.

Someone can help me to solve this problem ?

@toolstack
Copy link
Contributor

Did you import the originals or just a translation set?

@LucaFagan
Copy link
Author

LucaFagan commented May 16, 2018

The originals, i.e. source strings that I want to translate in other languages.
The list of strings to translate is empty.

@toolstack
Copy link
Contributor

Yes, but have you imported the originals in to the project, aka Project->Project actions->Import Originals?

After that you have to create a translation set for each language you want to translate to, Project->Project actions->New Translation Set.

@LucaFagan
Copy link
Author

I've done those things but in the list there are no strings to translate.

schermata 2018-05-16 alle 21 34 07

It seems the "import originals" does not work, the table wp_gp_originals is empty.

schermata 2018-05-16 alle 21 34 24

The file I've tried to import is localizable.strings and contains:

"STR_Success" = "Success!";
"STR_Error" = "Error!";
"STR_Warning" = "Warning!";
"STR_Attention" = "Attention!";
"STR_Wait" = "Please wait!";
"STR_Saving" = "Saving...";
"STR_Menu_Item_Gateways" = "Gateways";
"STR_Menu_Item_Broadcast" = "Broadcast";
"STR_Menu_Item_Favourites" = "Favourites";
"STR_Menu_Item_Configuration" = "Configuration";
"STR_Menu_Item_AddGateway" = "Add gateway";
"STR_Menu_Item_SetGatewayIds" = "Set gateway IDs";
"STR_Menu_Item_Settings" = "Settings";
"STR_Menu_Item_GroupNames" = "Group names";
"STR_Menu_Item_SceneNames" = "Scene names";
"STR_Menu_Item_Network" = "Network";
"STR_Menu_Item_Login" = "Login";
"STR_Login_Caption" = "EyeWiFi Login";
"STR_Login_Error" = "Wrong username or password!";
"STR_Login_Button_Login" = "Login";
"STR_Login_Button_Logout" = "Logout";

I'm trying in my mac using the following configuration:

  1. MAMP 4.4.1
  2. PHP 7.2.1
  3. Wordpress 4.9.5

@toolstack
Copy link
Contributor

Can you check to make sure your string file is UTF16-LE encoded before you import it?

@LucaFagan
Copy link
Author

It's a normal txt file.

If you want to try, here is the file:

localizable.strings

@toolstack
Copy link
Contributor

That's the problem, not sure why but the .strings format assumes the file is in UTF16-LE format and then converts it to UTF8. If it's already in UTF8 it will garble the file and no strings will be imported.

This seems to be a hold over from the standalone code and not the current recommendation from Apple.

I'm going to mark this as a bug and will create a PR for it, but in the mean time save the file as UTF16-LE and then it should import correctly.

@toolstack toolstack added the [Type] Bug An existing feature is broken. label May 17, 2018
@toolstack toolstack changed the title Not working for iOS .strings file iOS .strings file incorrectly assumes UTF16-LE encoding May 17, 2018
@LucaFagan
Copy link
Author

Thanks, converting the file works.

Waiting for the PR.

Regards

@toolstack
Copy link
Contributor

We'll just leave the issue open and let the PR close it automatically so we can keep track of it.

@toolstack
Copy link
Contributor

toolstack commented May 18, 2018

I reached out to the WP mobile folks on Slack to get some feedback on UTF8 vs UTF16LE and updated the PR to continue to support UTF16LE for imports (UTF8 is also now supported) as some of the Apple tools output it by default.

https://wordpress.slack.com/archives/C02RQC4LY/p1526569592000356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature is broken.
Projects
None yet
Development

No branches or pull requests

3 participants